From c1aefafa1aa82996f0558aedbdd5d1288810b9d7 Mon Sep 17 00:00:00 2001 From: Jason San Jose Date: Thu, 2 May 2013 16:43:59 -0700 Subject: [PATCH] check for /dev at executable location --- appshell/cefclient_gtk.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/appshell/cefclient_gtk.cpp b/appshell/cefclient_gtk.cpp index 8c5cfb80a..29ee73515 100644 --- a/appshell/cefclient_gtk.cpp +++ b/appshell/cefclient_gtk.cpp @@ -57,6 +57,11 @@ static gboolean HandleQuit(int signatl) { destroy(); } +bool FileExists(std::string path) { + struct stat buf; + return (stat(path.c_str(), &buf) >= 0) && (S_ISREG(buf.st_mode)); +} + int GetInitialUrl() { GtkWidget *dialog; const char* dialog_title = "Please select the index.html file"; @@ -143,13 +148,16 @@ int main(int argc, char* argv[]) { } szInitialUrl = AppGetRunningDirectory(); - szInitialUrl.append("/www/index.html"); + szInitialUrl.append("/dev/src/index.html"); - { - struct stat buf; - if(!(stat(szInitialUrl.c_str(), &buf) >= 0) || !(S_ISREG(buf.st_mode))) - if(GetInitialUrl() < 0) + if (!FileExists(szInitialUrl)) { + szInitialUrl = AppGetRunningDirectory(); + szInitialUrl.append("/www/index.html"); + + if (!FileExists(szInitialUrl)) { + if (GetInitialUrl() < 0) return 0; + } } // Initialize CEF.