1 #ifndef SimTK_SimTKCOMMON_PATHNAME_H_
2 #define SimTK_SimTKCOMMON_PATHNAME_H_
128 static void deconstructPathname(
const std::string& name,
129 bool& isAbsolutePath,
130 std::string& directory,
131 std::string& fileName,
132 std::string& extension);
153 std::string directory, fileName, extension;
154 deconstructPathname(pathname, isAbsolutePath, directory, fileName, extension);
156 directory = getCurrentWorkingDirectory() + directory;
157 return directory + fileName + extension;
164 std::string absPath = getAbsolutePathname(dirPathname);
165 if (!absPath.empty() && absPath[absPath.size()-1] != getPathSeparatorChar())
166 absPath += getPathSeparatorChar();
172 static bool fileExists(
const std::string& fileName);
177 static std::string getDefaultInstallDir();
181 static std::string addDirectoryOffset(
const std::string& base,
const std::string& offset);
186 static std::string getInstallDir(
const std::string& envInstallDir,
187 const std::string& offsetFromDefaultInstallDir);
190 static std::string getThisExecutablePath();
193 static std::string getThisExecutableDirectory();
201 static std::string getCurrentWorkingDirectory(
const std::string& drive=
"");
205 static std::string getRootDirectory(
const std::string& drive=
"");
208 static std::string getCurrentDriveLetter();
211 static std::string getCurrentDrive();
214 static bool environmentVariableExists(
const std::string& name);
220 static std::string getEnvironmentVariable(
const std::string& name);
224 static std::string getPathSeparator();
228 static char getPathSeparatorChar();
231 return c==
'/' || c==
'\\';
237 #endif // SimTK_SimTKCOMMON_PATHNAME_H_