MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ListMods

Method ListMods

neo/framework/FileSystem.cpp:1707–1796  ·  view source on GitHub ↗

=============== idFileSystemLocal::ListMods =============== */

Source from the content-addressed store, hash-verified

1705===============
1706*/
1707idModList *idFileSystemLocal::ListMods( void ) {
1708 int i;
1709 const int MAX_DESCRIPTION = 256;
1710 char desc[ MAX_DESCRIPTION ];
1711
1712 idStrList dirs;
1713 idStrList pk4s;
1714
1715 idModList *list = new idModList;
1716
1717 const char *search[ 4 ];
1718 int isearch;
1719
1720 search[0] = fs_savepath.GetString();
1721 search[1] = fs_devpath.GetString();
1722 search[2] = fs_basepath.GetString();
1723 search[3] = fs_cdpath.GetString();
1724
1725 for ( isearch = 0; isearch < 4; isearch++ ) {
1726 // skip empty cdpath or such, so we don't search C:\ or / -_-
1727 if ( search[ isearch ][ 0 ] == '\0' ) {
1728 continue;
1729 }
1730
1731 dirs.Clear();
1732 pk4s.Clear();
1733
1734 // scan for directories
1735 ListOSFiles( search[ isearch ], "/", dirs );
1736
1737 dirs.Remove( "." );
1738 dirs.Remove( ".." );
1739 dirs.Remove( "base" );
1740 dirs.Remove( "pb" );
1741
1742 // see if there are any pk4 files in each directory
1743 for( i = 0; i < dirs.Num(); i++ ) {
1744 idStr gamepath = BuildOSPath( search[ isearch ], dirs[ i ], "" );
1745 ListOSFiles( gamepath, ".pk4", pk4s );
1746 if ( pk4s.Num() ) {
1747 if ( !list->mods.Find( dirs[ i ] ) ) {
1748 // DG: ignore d3xp, it's added explicitly later, if available
1749 if ( dirs[ i ].Icmp( "d3xp" ) ) {
1750 list->mods.Append( dirs[ i ] );
1751 }
1752 }
1753 }
1754 }
1755 }
1756
1757 list->mods.Sort();
1758
1759 // read the descriptions for each mod - search all paths
1760 for ( i = 0; i < list->mods.Num(); i++ ) {
1761
1762 for ( isearch = 0; isearch < 4; isearch++ ) {
1763
1764 idStr descfile = BuildOSPath( search[ isearch ], list->mods[ i ], "description.txt" );

Callers 1

SetModsMenuGuiVarsMethod · 0.80

Calls 11

IcmpMethod · 0.60
GetStringMethod · 0.45
ClearMethod · 0.45
RemoveMethod · 0.45
NumMethod · 0.45
FindMethod · 0.45
AppendMethod · 0.45
SortMethod · 0.45
DWarningMethod · 0.45
c_strMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected