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

Function getModNameFromPath

Engine/source/console/console.cpp:1894–1935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1892//------------------------------------------------------------------------------
1893
1894StringTableEntry getModNameFromPath(const char *path)
1895{
1896 if(path == NULL || *path == 0)
1897 return NULL;
1898
1899 char buf[1024];
1900 buf[0] = 0;
1901
1902 if(path[0] == '/' || path[1] == ':')
1903 {
1904 // It's an absolute path
1905 const StringTableEntry exePath = Platform::getMainDotCsDir();
1906 U32 len = dStrlen(exePath);
1907 if(dStrnicmp(exePath, path, len) == 0)
1908 {
1909 const char *ptr = path + len + 1;
1910 const char *slash = dStrchr(ptr, '/');
1911 if(slash)
1912 {
1913 dStrncpy(buf, ptr, slash - ptr);
1914 buf[slash - ptr] = 0;
1915 }
1916 else
1917 return NULL;
1918 }
1919 else
1920 return NULL;
1921 }
1922 else
1923 {
1924 const char *slash = dStrchr(path, '/');
1925 if(slash)
1926 {
1927 dStrncpy(buf, path, slash - path);
1928 buf[slash - path] = 0;
1929 }
1930 else
1931 return NULL;
1932 }
1933
1934 return StringTable->insert(buf);
1935}
1936
1937void postConsoleInput( RawData data )
1938{

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