MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getModNameFromPath

Function getModNameFromPath

Engine/source/console/console.cpp:1808–1849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1806//------------------------------------------------------------------------------
1807
1808StringTableEntry getModNameFromPath(const char *path)
1809{
1810 if(path == NULL || *path == 0)
1811 return NULL;
1812
1813 char buf[1024];
1814 buf[0] = 0;
1815
1816 if(path[0] == '/' || path[1] == ':')
1817 {
1818 // It's an absolute path
1819 const StringTableEntry exePath = Platform::getMainDotCsDir();
1820 U32 len = dStrlen(exePath);
1821 if(dStrnicmp(exePath, path, len) == 0)
1822 {
1823 const char *ptr = path + len + 1;
1824 const char *slash = dStrchr(ptr, '/');
1825 if(slash)
1826 {
1827 dStrncpy(buf, ptr, slash - ptr);
1828 buf[slash - ptr] = 0;
1829 }
1830 else
1831 return NULL;
1832 }
1833 else
1834 return NULL;
1835 }
1836 else
1837 {
1838 const char *slash = dStrchr(path, '/');
1839 if(slash)
1840 {
1841 dStrncpy(buf, path, slash - path);
1842 buf[slash - path] = 0;
1843 }
1844 else
1845 return NULL;
1846 }
1847
1848 return StringTable->insert(buf);
1849}
1850
1851void postConsoleInput( RawData data )
1852{

Callers 3

readMethod · 0.85
compileExecMethod · 0.85

Calls 5

dStrnicmpFunction · 0.85
dStrncpyFunction · 0.85
dStrlenFunction · 0.50
dStrchrFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected