diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-05 10:58:49 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:30:34 +0100 |
commit | 5720d463bbdcaa252ba3dc8cc2633a2a8994f2cb (patch) | |
tree | 7cb0e03e331f629bf8eeb8e7b2b1e1fa8fff662c | |
parent | 4e9a5dc18988790284a8ea66742338f4662c508c (diff) | |
download | msitools-5720d463bbdcaa252ba3dc8cc2633a2a8994f2cb.tar.gz msitools-5720d463bbdcaa252ba3dc8cc2633a2a8994f2cb.tar.xz msitools-5720d463bbdcaa252ba3dc8cc2633a2a8994f2cb.zip |
differentiate directory separators
-rw-r--r-- | libmsi/database.c | 14 | ||||
-rw-r--r-- | 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 |