All library functions should be in a proper namespace.
#endif
}
-const char* getvnchomedir()
+const char* os::getvnchomedir()
{
return gethomedir(false);
}
-const char* getuserhomedir()
+const char* os::getuserhomedir()
{
return gethomedir(true);
}
#ifndef OS_OS_H
#define OS_OS_H
-/*
- * Get VNC home directory ($HOME/.vnc or %APPDATA%/vnc/).
- * If HOME environment variable is set then it is used.
- * Otherwise home directory is obtained via getpwuid function.
- *
- * Returns NULL on failure.
- */
-const char* getvnchomedir();
+namespace os {
-/*
- * Get user home directory.
- * If HOME environment variable is set then it is used.
- * Otherwise home directory is obtained via getpwuid function.
- *
- * Returns NULL on failure.
- */
-const char* getuserhomedir();
+ /*
+ * Get VNC home directory ($HOME/.vnc or %APPDATA%/vnc/).
+ * If HOME environment variable is set then it is used.
+ * Otherwise home directory is obtained via getpwuid function.
+ *
+ * Returns NULL on failure.
+ */
+ const char* getvnchomedir();
+
+ /*
+ * Get user home directory.
+ * If HOME environment variable is set then it is used.
+ * Otherwise home directory is obtained via getpwuid function.
+ *
+ * Returns NULL on failure.
+ */
+ const char* getuserhomedir();
+
+}
#endif /* OS_OS_H */
static char full_path[PATH_MAX];
const char* homedir;
- homedir = getvnchomedir();
+ homedir = os::getvnchomedir();
if (homedir == NULL)
return "";
/* Certificate is fine, except we don't know the issuer, so TOFU time */
- homeDir = getvnchomedir();
+ homeDir = os::getvnchomedir();
if (homeDir == NULL) {
throw AuthFailureException("Could not obtain VNC home directory "
"path for known hosts storage");
}
if (!fname) {
- const char *homeDir = getvnchomedir();
+ const char *homeDir = os::getvnchomedir();
if (homeDir == NULL) {
fprintf(stderr, "Can't obtain VNC home directory\n");
exit(1);
ServerDialog *dialog = (ServerDialog*)data;
if (!dialog->usedDir)
- dialog->usedDir = strDup(getuserhomedir());
+ dialog->usedDir = strDup(os::getuserhomedir());
Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir, _("TigerVNC configuration (*.tigervnc)"),
0, _("Select a TigerVNC configuration file"));
const char* servername = dialog->serverName->value();
const char* filename;
if (!dialog->usedDir)
- dialog->usedDir = strDup(getuserhomedir());
+ dialog->usedDir = strDup(os::getuserhomedir());
Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir, _("TigerVNC configuration (*.tigervnc)"),
2, _("Save the TigerVNC configuration to file"));
return;
#endif
- const char* homeDir = getvnchomedir();
+ const char* homeDir = os::getvnchomedir();
if (homeDir == NULL)
throw Exception(_("Could not obtain the home directory path"));
return;
#endif
- const char* homeDir = getvnchomedir();
+ const char* homeDir = os::getvnchomedir();
if (homeDir == NULL)
throw Exception(_("Could not obtain the home directory path"));
return;
#endif
- const char* homeDir = getvnchomedir();
+ const char* homeDir = os::getvnchomedir();
if (homeDir == NULL)
throw Exception(_("Could not obtain the home directory path"));
return loadFromReg();
#endif
- const char* homeDir = getvnchomedir();
+ const char* homeDir = os::getvnchomedir();
if (homeDir == NULL)
throw Exception(_("Could not obtain the home directory path"));
static void mkvnchomedir()
{
// Create .vnc in the user's home directory if it doesn't already exist
- const char* homeDir = getvnchomedir();
+ const char* homeDir = os::getvnchomedir();
if (homeDir == NULL) {
vlog.error(_("Could not obtain the home directory path"));
} else {