Skip to content

Commit

Permalink
DOSBox: verbose logging for data_dirs (tkashkin#279)
Browse files Browse the repository at this point in the history
Former-commit-id: 2f7c584
  • Loading branch information
tkashkin committed Jul 6, 2019
1 parent 5f0d7e4 commit 6491a20
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/data/compat/DOSBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ namespace GameHub.Data.Compat
var user_data_dir = Environment.get_user_data_dir();
var system_data_dirs = Environment.get_system_data_dirs();

if(GameHub.Application.log_verbose)
{
debug("[DOSBox.init] ProjectConfig.DATADIR: '%s'", ProjectConfig.DATADIR);
debug("[DOSBox.init] user_data_dir: '%s'", user_data_dir);
}

if(user_data_dir != null && user_data_dir.length > 0)
{
if(!(user_data_dir in data_dirs)) data_dirs += user_data_dir;
Expand All @@ -65,10 +71,19 @@ namespace GameHub.Data.Compat
{
foreach(var system_data_dir in system_data_dirs)
{
if(GameHub.Application.log_verbose)
{
debug("[DOSBox.init] system_data_dir: '%s'", system_data_dir);
}
if(!(system_data_dir in data_dirs)) data_dirs += system_data_dir;
}
}

if(GameHub.Application.log_verbose)
{
debug("[DOSBox.init] data_dirs: {'%s'}", string.joinv("', '", data_dirs));
}

foreach(var dir in data_dirs)
{
var data_dir = FSUtils.file(dir, data_path);
Expand Down Expand Up @@ -162,14 +177,10 @@ namespace GameHub.Data.Compat
private static bool is_dos_executable(File? file)
{
if(file == null || !file.query_exists()) return false;
var info = Utils.run({"file", file.get_path()}, null, null, false, true, false);
if(info != null && info.length > 0)
var type = Utils.run({"file", "-b", file.get_path()}, null, null, false, true, false);
if(type != null && type.length > 0)
{
var type = info.split(":")[1];
if(type != null && type.length > 0)
{
return "DOS" in type;
}
return "DOS" in type;
}
return false;
}
Expand Down

0 comments on commit 6491a20

Please sign in to comment.