diff options
Diffstat (limited to 'src/fileutils.cpp')
| -rw-r--r-- | src/fileutils.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/fileutils.cpp b/src/fileutils.cpp index fa600f306..7f36b4b24 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -79,47 +79,3 @@ std::string FileReader::GetString() const } return buffer; } - -std::string FileSystem::ExpandPath(const std::string& base, const std::string& fragment) -{ - // The fragment is an absolute path, don't modify it. - if (fragment[0] == '/' || FileSystem::StartsWithWindowsDriveLetter(fragment)) - return fragment; - - // The fragment is relative to a home directory, expand that. - if (!fragment.compare(0, 2, "~/", 2)) - { - const char* homedir = getenv("HOME"); - if (homedir && *homedir) - return std::string(homedir) + '/' + fragment.substr(2); - } - - return base + '/' + fragment; -} - -bool FileSystem::FileExists(const std::string& file) -{ - struct stat sb; - if (stat(file.c_str(), &sb) == -1) - return false; - - if ((sb.st_mode & S_IFDIR) > 0) - return false; - - return !access(file.c_str(), F_OK); -} - -std::string FileSystem::GetFileName(const std::string& name) -{ -#ifdef _WIN32 - size_t pos = name.find_last_of("\\/"); -#else - size_t pos = name.rfind('/'); -#endif - return pos == std::string::npos ? name : name.substr(++pos); -} - -bool FileSystem::StartsWithWindowsDriveLetter(const std::string& path) -{ - return (path.length() > 2 && isalpha(path[0]) && path[1] == ':'); -} |
