diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-04-30 19:56:17 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-04-30 19:56:17 +0200 |
commit | 15c04087196b2e0be5b6e1992bf44cde75f0183d (patch) | |
tree | 2121a59abe8c42253b10f905f5d6d2244581b523 | |
parent | 0655cacae1adc838f2c886013545265c24d36c8c (diff) |
Find config file and exit if not found
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 74674cf..9706ff1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -417,7 +417,7 @@ CMainApplication::CMainApplication( int argc, char *argv[] ) fprintf(stderr, "Invalid flag: %s\n", argv[i]); usage(); } else { - src_window_id = strtol(argv[1], nullptr, 0); + src_window_id = strtol(argv[i], nullptr, 0); } } @@ -635,6 +635,15 @@ bool CMainApplication::BInit() //dirname(cwd); char action_manifest_path[PATH_MAX]; realpath("config/hellovr_actions.json", action_manifest_path); + if(access(action_manifest_path, F_OK) == -1) { + strcpy(action_manifest_path, "/usr/share/vr-video-player/hellovr_actions.json"); + if(access(action_manifest_path, F_OK) == -1) { + fprintf(stderr, "Unable to find hellovr_action.json!\n"); + exit(1); + } + } + + fprintf(stderr, "Using config file: %s\n", action_manifest_path); vr::VRInput()->SetActionManifestPath(action_manifest_path); |