Skip to content

Commit

Permalink
small code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Jul 27, 2014
1 parent 58cfa09 commit 03b02f4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/core/Tools.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,27 @@ namespace Venom {
foreach (string s in GLib.Environment.get_system_data_dirs()) {
string dir = Path.build_filename(s, "venom");
File f = File.new_for_path(dir);
if(f.query_exists())
if(f.query_exists()) {
Logger.log(LogLevel.INFO, "Found system data directory at " + dir);
return dir;
}
}
// Check for common directories on portable versions
string[] portable_directories = {
Path.build_filename(GLib.Environment.get_user_data_dir(), "venom"),
Path.build_filename("share", "venom"),
Path.build_filename("..", "share", "venom")
};
for (int i = 0; i < portable_directories.length; ++i) {
File f = File.new_for_path(portable_directories[i]);
if(f.query_exists())
return portable_directories[i];
foreach (string s in portable_directories) {
File f = File.new_for_path(s);
if(f.query_exists()) {
Logger.log(LogLevel.INFO, "Found portable data directory at " + s);
return s;
}
}

// Assume that our current pwd is our data dir
Logger.log(LogLevel.INFO, "Assuming current working directory is data directoy");
return "";
}

Expand Down

0 comments on commit 03b02f4

Please sign in to comment.