From c242626edff797de13bf2dbc7aaa7d32bd340435 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 24 Sep 2014 00:51:33 +0300 Subject: [PATCH] client: urho3d_path --- src/client/app.cpp | 7 ++++--- src/client/config.cpp | 6 ++++++ src/client/config.h | 1 + src/client/main.cpp | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/client/app.cpp b/src/client/app.cpp index 557936e..cd56b03 100644 --- a/src/client/app.cpp +++ b/src/client/app.cpp @@ -47,12 +47,13 @@ struct CApp: public App, public u3d::Application engineParameters_["FullScreen"] = false; engineParameters_["Headless"] = false; - // TODO: Proper paths + ss_ urho3d_path = interface::getGlobalFilesystem()->get_absolute_path( + g_client_config.urho3d_path); ss_ tmp_path = interface::getGlobalFilesystem()->get_absolute_path( g_client_config.cache_path+"/tmp"); engineParameters_["ResourcePaths"] = u3d::String()+ - "/home/celeron55/softat/Urho3D/Bin/CoreData;"+ - "/home/celeron55/softat/Urho3D/Bin/Data;"+ + urho3d_path.c_str()+"/Bin/CoreData;"+ + urho3d_path.c_str()+"/Bin/Data;"+ tmp_path.c_str(); engineParameters_["AutoloadPaths"] = ""; diff --git a/src/client/config.cpp b/src/client/config.cpp index 07894d4..f732b65 100644 --- a/src/client/config.cpp +++ b/src/client/config.cpp @@ -41,6 +41,12 @@ bool Config::check_paths() fail = true; } + if(!check_file_readable(urho3d_path+"/Bin/CoreData/Shaders/GLSL/Basic.glsl")){ + log_e(MODULE, "Urho3D doesn't seem to exist in urho3d_path=\"%s\"", + cs(urho3d_path)); + fail = true; + } + auto *fs = interface::getGlobalFilesystem(); fs->create_directories(cache_path); if(!check_file_writable(cache_path+"/write.test")){ diff --git a/src/client/config.h b/src/client/config.h index a2db5fb..77cb147 100644 --- a/src/client/config.h +++ b/src/client/config.h @@ -10,6 +10,7 @@ namespace client ss_ server_address; ss_ share_path = ".."; ss_ cache_path = "../cache"; + ss_ urho3d_path = "../../Urho3D"; bool check_paths(); }; diff --git a/src/client/main.cpp b/src/client/main.cpp index f189d9d..fc2a16d 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -50,13 +50,14 @@ int main(int argc, char *argv[]) client::Config &config = g_client_config; - const char opts[100] = "hs:P:C:l:"; + const char opts[100] = "hs:P:C:U:l:"; const char usagefmt[1000] = "Usage: %s [OPTION]...\n" " -h Show this help\n" " -s [address] Specify server address\n" " -P [share_path] Specify share/ path\n" " -C [cache_path] Specify cache/ path\n" + " -U [urho3d_path] Specify Urho3D path\n" " -l [integer] Set maximum log level (0...5)\n" ; @@ -80,6 +81,10 @@ int main(int argc, char *argv[]) fprintf(stderr, "INFO: config.cache_path: %s\n", c55_optarg); config.cache_path = c55_optarg; break; + case 'U': + fprintf(stderr, "INFO: config.urho3d_path: %s\n", c55_optarg); + config.urho3d_path = c55_optarg; + break; case 'l': log_set_max_level(atoi(c55_optarg)); break;