From 5720d463bbdcaa252ba3dc8cc2633a2a8994f2cb Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 5 Dec 2012 10:58:49 +0100 Subject: differentiate directory separators --- libmsi/database.c | 14 +++++++------- libmsi/msipriv.h | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libmsi/database.c b/libmsi/database.c index 18fbc2e..62cf364 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -650,10 +650,10 @@ LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db, const char * db->outfile = stg; g_object_ref(G_OBJECT(db->outfile)); - if (!strchr( szPersist, '\\' )) + if (!strstr( szPersist, DIRSEP )) { getcwd( path, MAX_PATH ); - strcat( path, "\\" ); + strcat( path, DIRSEP ); strcat( path, szPersist ); } else @@ -702,10 +702,10 @@ LibmsiResult libmsi_database_open(const char *szDBPath, const char *szPersist, L goto end; } - if (!strchr( szDBPath, '\\' )) + if (!strstr( szDBPath, DIRSEP )) { getcwd( path, MAX_PATH ); - strcat( path, "\\" ); + strcat( path, DIRSEP ); strcat( path, szDBPath ); } else @@ -1051,8 +1051,8 @@ static char *msi_import_stream_filename(const char *path, const char *name) msi_free (fullname); return NULL; } - *ptr++ = '\\'; - strcpy( ptr, name ); + strcpy( ptr, DIRSEP ); + strcat( ptr, name ); return fullname; } @@ -1177,7 +1177,7 @@ static unsigned _libmsi_database_import(LibmsiDatabase *db, const char *folder, return LIBMSI_RESULT_OUTOFMEMORY; strcpy( path, folder ); - strcat( path, "\\" ); + strcat( path, DIRSEP ); strcat( path, file ); data = msi_read_text_archive( path, &len ); diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h index 375cc51..2b78eb5 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -42,6 +42,12 @@ #include "libmsi.h" #include "list.h" +#ifdef _WIN32 +#define DIRSEP "\\" +#else +#define DIRSEP "/" +#endif + #pragma GCC visibility push(hidden) #ifndef MAX_PATH -- cgit