[Development] Rename function "gethomedir" to "getvnchomedir" and rewrite it in
platform-intependent manner.
Thanks to Guillaume Destuynder.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4252 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/vncviewer/vncviewer.cxx b/unix/vncviewer/vncviewer.cxx
index f3a5e01..8b741c0 100644
--- a/unix/vncviewer/vncviewer.cxx
+++ b/unix/vncviewer/vncviewer.cxx
@@ -328,14 +328,13 @@
// Create .vnc in the user's home directory if it doesn't already exist
char* homeDir = NULL;
- if (gethomedir(&homeDir) == -1)
- vlog.error("Could not create .vnc directory: can't obtain home directory path.");
- else {
- CharArray vncDir(strlen(homeDir)+6);
- sprintf(vncDir.buf, "%s/.vnc", homeDir);
- int result = mkdir(vncDir.buf, 0755);
+ if (getvnchomedir(&homeDir) == -1) {
+ vlog.error("Could not create VNC home directory: can't obtain home "
+ "directory path.");
+ } else {
+ int result = mkdir(homeDir, 0755);
if (result == -1 && errno != EEXIST)
- vlog.error("Could not create .vnc directory: %s.", strerror(errno));
+ vlog.error("Could not create VNC home directory: %s.", strerror(errno));
delete [] homeDir;
}