summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2/Server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IcePatch2/Server.cpp')
-rw-r--r--cpp/src/IcePatch2/Server.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp
index 7f30e1169d5..013f66c0c11 100644
--- a/cpp/src/IcePatch2/Server.cpp
+++ b/cpp/src/IcePatch2/Server.cpp
@@ -16,6 +16,9 @@
# include <direct.h>
#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+
using namespace std;
using namespace Ice;
using namespace IcePatch2;
@@ -122,28 +125,16 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
}
}
+ if(!isDir(dataDir))
+ {
+ throw "`" + dataDir + "' is not a directory";
+ }
+
FileInfoSeq infoSeq;
try
{
-#ifdef _WIN32
- if(dataDir[0] != '/' && !(dataDir.size() > 1 && isalpha(dataDir[0]) && dataDir[1] == ':'))
- {
- char cwd[_MAX_PATH];
- if(_getcwd(cwd, _MAX_PATH) == NULL)
-#else
- if(dataDir[0] != '/')
- {
- char cwd[PATH_MAX];
- if(getcwd(cwd, PATH_MAX) == NULL)
-#endif
- {
- throw "cannot get the current directory:\n" + lastError();
- }
-
- dataDir = string(cwd) + '/' + dataDir;
- }
-
+ dataDir = normalize(dataDir);
loadFileInfoSeq(dataDir, infoSeq);
}
catch(const string& ex)
@@ -243,7 +234,7 @@ IcePatch2::PatcherService::usage(const string& appName)
"--nochdir Do not change the current working directory."
);
#endif
- cerr << "Usage: " << appName << " [options] [DIR]" << endl;
+ cerr << "Usage: " << appName << " [options] DIR" << endl;
cerr << options << endl;
}