| 1892 | //------------------------------------------------------------------------------ |
| 1893 | |
| 1894 | StringTableEntry 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 | |
| 1937 | void postConsoleInput( RawData data ) |
| 1938 | { |