#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
+#include <shlobj.h>
#include "epan/unicode-utils.h"
#else
#include <pwd.h>
return ret;
}
+/*
+ * Get the (default) directory in which personal data is stored.
+ *
+ * On Win32, this is the "My Documents" folder in the personal profile.
+ * On UNIX this is simply the current directory.
+ */
+/* XXX - should this and the get_home_dir() be merged? */
+/* XXX - is U3 affected somehow? */
+extern char *
+get_persdatafile_dir(void)
+{
+#ifdef _WIN32
+ {
+ TCHAR tszPath[MAX_PATH];
+ char *szPath;
+ HRESULT hrRet;
+
+ hrRet = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, tszPath);
+ if(hrRet == S_OK) {
+ szPath = utf_16to8(tszPath);
+ return szPath;
+ } else {
+ return "";
+ }
+ }
+#else
+ return "";
+#endif
+}
+
#ifdef _WIN32
/*
* Returns the user's home directory on Win32.
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
-/*
- * Given a pathname, return the last component.
- */
-extern const char *get_basename(const char *);
-
-/*
- * Given a pathname, return a string containing everything but the
- * last component. NOTE: this overwrites the pathname handed into
- * it....
- */
-extern char *get_dirname(char *);
-
-/*
- * Given a pathname, return:
- *
- * the errno, if an attempt to "stat()" the file fails;
- *
- * EISDIR, if the attempt succeeded and the file turned out
- * to be a directory;
- *
- * 0, if the attempt succeeded and the file turned out not
- * to be a directory.
- */
-extern int test_for_directory(const char *);
-
-/*
- * Given a pathname, return:
- *
- * the errno, if an attempt to "stat()" the file fails;
- *
- * ESPIPE, if the attempt succeeded and the file turned out
- * to be a FIFO;
- *
- * 0, if the attempt succeeded and the file turned out not
- * to be a FIFO.
- */
-extern int test_for_fifo(const char *);
-
/*
* Get the pathname of the directory from which the executable came,
* and save it for future use. Returns NULL on success, and a
*/
extern const char *get_progfile_dir(void);
-/*
- * Get the directory in which global configuration and data files are
- * stored.
- */
-extern const char *get_datafile_dir(void);
-
/*
* Find the directory in which plugins are stored; this must be called
* after init_progfile_dir() is called.
*/
extern gboolean running_in_build_directory(void);
+/*
+ * Get the directory in which global configuration files are
+ * stored.
+ */
+extern const char *get_datafile_dir(void);
+
/*
* Construct the path name of a global configuration file, given the
* file name.
*/
extern char *get_persconffile_path(const char *filename, gboolean for_writing);
+/*
+ * Get the (default) directory in which personal data is stored.
+ *
+ * On Win32, this is the "My Documents" folder in the personal profile.
+ * On UNIX this is simply the current directory.
+ */
+extern char *get_persdatafile_dir(void);
+
/*
* Construct the path name of a file in $TMP/%TEMP% directory.
* Or "/tmp/<filename>" (C:\<filename>) if that fails.
*/
extern char *get_tempfile_path(const char *filename);
-/* Delete a file */
-extern gboolean deletefile (const char *path);
-
/*
* Return an error message for UNIX-style errno indications on open or
* create operations.
*/
extern const char *file_write_error_message(int err);
+/*
+ * Given a pathname, return the last component.
+ */
+extern const char *get_basename(const char *);
+
+/*
+ * Given a pathname, return a string containing everything but the
+ * last component. NOTE: this overwrites the pathname handed into
+ * it....
+ */
+extern char *get_dirname(char *);
+
+/*
+ * Given a pathname, return:
+ *
+ * the errno, if an attempt to "stat()" the file fails;
+ *
+ * EISDIR, if the attempt succeeded and the file turned out
+ * to be a directory;
+ *
+ * 0, if the attempt succeeded and the file turned out not
+ * to be a directory.
+ */
+extern int test_for_directory(const char *);
+
+/*
+ * Given a pathname, return:
+ *
+ * the errno, if an attempt to "stat()" the file fails;
+ *
+ * ESPIPE, if the attempt succeeded and the file turned out
+ * to be a FIFO;
+ *
+ * 0, if the attempt succeeded and the file turned out not
+ * to be a FIFO.
+ */
+extern int test_for_fifo(const char *);
+
+/* Delete a file */
+extern gboolean deletefile (const char *path);
+
/*
* Check, if file is existing.
*/