Added meta information in session file XML, for quick access to file

info (SessionCreator::info), displayed in the user interface (list of
sessions in quick access).
This commit is contained in:
brunoherbelin
2020-07-04 10:18:26 +02:00
parent 3f0def5c26
commit 84cd772644
8 changed files with 72 additions and 16 deletions

View File

@@ -98,17 +98,30 @@ std::string SystemToolkit::home_path()
char *mHomePath;
// try the system user info
struct passwd* pwd = getpwuid(getuid());
if (pwd) {
if (pwd)
mHomePath = pwd->pw_dir;
}
else {
else
// try the $HOME environment variable
mHomePath = getenv("HOME");
}
return string(mHomePath) + PATH_SEP;
}
std::string SystemToolkit::username()
{
// 1. find home
char *user;
// try the system user info
struct passwd* pwd = getpwuid(getuid());
if (pwd)
user = pwd->pw_name;
else
// try the $USER environment variable
user = getenv("USER");
return string(user);
}
bool create_directory(const string& path)
{
return !mkdir(path.c_str(), 0755) || errno == EEXIST;
@@ -140,7 +153,6 @@ string SystemToolkit::settings_path()
// fallback to home if settings path does not exists
return home;
}
}
string SystemToolkit::full_filename(const std::string& path, const string &filename)