Remove unnecessary file existence check in main

mkdir is able to return an error code in errno to indicate that the
directory requested to be created already exists (EEXIST).
This commit is contained in:
Nebuleon Fumika authored and Maarten ter Huurne committed 2014-08-13 03:16:38 +02:00
1 parent 457fb0a085
commit ebb34f3e00
1 file changed
+1 -1
+1 -1
View File
@@ -157,7 +157,7 @@ int main(int /*argc*/, char * /*argv*/[]) {
}
gmenu2x_home = (string)home + (string)"/.gmenu2x";
if (!fileExists(gmenu2x_home) && mkdir(gmenu2x_home.c_str(), 0770) < 0) {
if (mkdir(gmenu2x_home.c_str(), 0770) < 0 && errno != EEXIST) {
ERROR("Unable to create gmenu2x home directory.\n");
return 1;
}