1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 06:39:41 +02:00

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 2014-08-10 22:36:31 +00:00 committed by Maarten ter Huurne
parent 457fb0a085
commit ebb34f3e00

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;
}