Merge lp:~widelands-dev/widelands/bug-1703833-catch-missing-datadir into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8760
Proposed branch: lp:~widelands-dev/widelands/bug-1703833-catch-missing-datadir
Merge into: lp:widelands
Diff against target: 30 lines (+10/-3)
1 file modified
src/wlapplication.cc (+10/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1703833-catch-missing-datadir
Reviewer Review Type Date Requested Status
Notabilis diff, testing Approve
Review via email: mp+349629@code.launchpad.net

Commit message

Exit gracefully if user specifies a datadir that doesn't exist

To post a comment you must log in.
Revision history for this message
Notabilis (notabilis27) wrote :

Diff is mostly looking good. Passing a non-existing directory to the fixed code (see diff) worked fine.

review: Needs Fixing (diff, testing)
Revision history for this message
Notabilis (notabilis27) wrote :

Looking good now, thanks.

review: Approve (diff, testing)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks!

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3677. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/405393952.
Appveyor build 3476. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1703833_catch_missing_datadir-3476.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.

Travis build 3677. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/405393952.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3690. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/405785266.
Appveyor build 3489. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1703833_catch_missing_datadir-3489.

Revision history for this message
GunChleoc (gunchleoc) wrote :

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2018-07-07 19:20:22 +0000
+++ src/wlapplication.cc 2018-07-19 11:13:32 +0000
@@ -157,7 +157,9 @@
157 // http://pubs.opengroup.org/onlinepubs/009695399/functions/realpath.html157 // http://pubs.opengroup.org/onlinepubs/009695399/functions/realpath.html
158 char* rp = realpath(path.c_str(), buffer);158 char* rp = realpath(path.c_str(), buffer);
159 log("Realpath: %s\n", rp);159 log("Realpath: %s\n", rp);
160 assert(rp);160 if (!rp) {
161 throw wexception("Unable to get absolute path for %s", path.c_str());
162 }
161 return std::string(rp);163 return std::string(rp);
162#else164#else
163 return path;165 return path;
@@ -936,8 +938,13 @@
936 get_executable_directory() + FileSystem::file_separator() + INSTALL_DATADIR;938 get_executable_directory() + FileSystem::file_separator() + INSTALL_DATADIR;
937 }939 }
938 if (!is_absolute_path(datadir_)) {940 if (!is_absolute_path(datadir_)) {
939 datadir_ = absolute_path_if_not_windows(FileSystem::get_working_directory() +941 try {
940 FileSystem::file_separator() + datadir_);942 datadir_ = absolute_path_if_not_windows(FileSystem::get_working_directory() +
943 FileSystem::file_separator() + datadir_);
944 } catch (const WException& e) {
945 log("Error parsing datadir: %s\n", e.what());
946 exit(1);
947 }
941 }948 }
942 if (commandline_.count("datadir_for_testing")) {949 if (commandline_.count("datadir_for_testing")) {
943 datadir_for_testing_ = commandline_["datadir_for_testing"];950 datadir_for_testing_ = commandline_["datadir_for_testing"];

Subscribers

People subscribed via source and target branches

to status/vote changes: