]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.c
Remove obsolete .cvsignore files.
[bacula/bacula] / bacula / src / lib / parse_conf.c
index a76aacc39603207c06981cfb27a74bed5f3483aa..1e432a640efe04f3d3e880b109b7ee73cc5f9648 100755 (executable)
@@ -929,13 +929,16 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type)
 const char *get_default_configdir()
 {
 #if defined(HAVE_WIN32)
-#define DEFAULT_CONFIGDIR "C:\\Documents and Settings\\All Users\\Application Data\\Bacula"
-
    HRESULT hr;
    static char szConfigDir[MAX_PATH + 1] = { 0 };
 
+   if (!p_SHGetFolderPath) {
+      bstrncpy(szConfigDir, DEFAULT_CONFIGDIR, sizeof(szConfigDir));
+      return szConfigDir;
+   }
+
    if (szConfigDir[0] == '\0') {
-      hr = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szConfigDir);
+      hr = p_SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szConfigDir);
 
       if (SUCCEEDED(hr)) {
          bstrncat(szConfigDir, "\\Bacula", sizeof(szConfigDir));
@@ -952,15 +955,9 @@ const char *get_default_configdir()
 bool
 find_config_file(const char *config_file, char *full_path)
 {
-#if defined(HAVE_WIN32)
-   if (strpbrk(config_file, ":/\\") != NULL) {
+   if (first_path_separator(config_file) != NULL) {
       return false;
    }
-#else
-   if (strchr(config_file, '/') != NULL) {
-      return false;
-   }
-#endif
 
    struct stat st;
 
@@ -978,8 +975,7 @@ find_config_file(const char *config_file, char *full_path)
 
    memcpy(full_path, config_dir, dir_length + 1);
 
-   if (full_path[dir_length - 1] != '/' && 
-       full_path[dir_length - 1] != '\\') {
+   if (!IsPathSeparator(full_path[dir_length - 1])) {
       full_path[dir_length++] = '/';
    }