}
-// Create absolute path. If impossible, don't do anything
-// Supports ./ and ~/. Later we can add support for ~logname/. (Asger)
-string const expandPath(string const & path)
-{
- // checks for already absolute path
- string rTemp = replaceEnvironmentPath(path);
- if (FileName::isAbsolute(rTemp))
- return rTemp;
-
- string temp;
- string const copy = rTemp;
-
- // Split by next /
- rTemp = split(rTemp, temp, '/');
-
- if (temp == ".")
- return FileName::getcwd().absFileName() + '/' + rTemp;
-
- if (temp == "~")
- return Package::get_home_dir().absFileName() + '/' + rTemp;
-
- if (temp == "..")
- return makeAbsPath(copy).absFileName();
-
- // Don't know how to handle this
- return copy;
-}
-
-
// Search the string for ${VAR} and $VAR and replace VAR using getenv.
string const replaceEnvironmentPath(string const & path)
{
FileName const unzipFile(FileName const & zipped_file,
std::string const & unzipped_file = std::string());
-/// Create absolute path. If impossible, don't do anything
-std::string const expandPath(std::string const & path);
-
/** Convert relative path into absolute path based on a basepath.
If relpath is absolute, just use that.
If basepath doesn't exist use CWD.