diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2008-05-14 17:38:40 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2008-05-14 17:38:40 +0000 |
commit | 013532c1dff104c2eeeaf91a093cbd6640f94e6a (patch) | |
tree | 7948a83fd66e151a5e35a5901a5b72b432503752 /packages | |
parent | c564b153591198924ed79b46967a6b518520d46a (diff) |
oops, removed add_tilde_support_toopen-0.41.4.patch from this one
svn path=/trunk/; revision=9798
Diffstat (limited to 'packages')
-rw-r--r-- | packages/patches/use_FILENAME_MAX_for_file_operations-0.41.4.patch | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/packages/patches/use_FILENAME_MAX_for_file_operations-0.41.4.patch b/packages/patches/use_FILENAME_MAX_for_file_operations-0.41.4.patch index e0c30433..3901a906 100644 --- a/packages/patches/use_FILENAME_MAX_for_file_operations-0.41.4.patch +++ b/packages/patches/use_FILENAME_MAX_for_file_operations-0.41.4.patch @@ -241,61 +241,6 @@ Index: s_path.c =================================================================== --- s_path.c (revision 9725) +++ s_path.c (working copy) -@@ -22,6 +22,10 @@ - #include <io.h> - #endif - -+#ifdef MSW -+#include <windows.h> -+#endif -+ - #include <string.h> - #include "m_pd.h" - #include "m_imp.h" -@@ -69,6 +73,30 @@ - *to = 0; - } - -+/* expand env vars and ~ at the beginning of a path and make a copy to return */ -+static void sys_expandpath(const char *from, char *to) -+{ -+ if ((strlen(from) == 1 && from[0] == '~') || (strncmp(from,"~/", 2) == 0)) -+ { -+#ifdef MSW -+ const char *home = getenv("USERPROFILE"); -+#else -+ const char *home = getenv("HOME"); -+#endif -+ if(home) -+ { -+ strncpy(to, home, FILENAME_MAX - 1); -+ strncat(to, from + 1, FILENAME_MAX - strlen(from) - 2); -+ } -+ } -+ else -+ strncpy(to, from, FILENAME_MAX - 1); -+#ifdef MSW -+ char buf[FILENAME_MAX]; -+ ExpandEnvironmentStrings(to, buf, FILENAME_MAX - 2); -+ strncpy(to, buf, FILENAME_MAX - 1); -+#endif -+} - /******************* Utility functions used below ******************/ - - /*! -@@ -196,9 +224,11 @@ - char *dirresult, char **nameresult, unsigned int size, int bin) - { - int fd; -+ char buf[FILENAME_MAX]; - if (strlen(dir) + strlen(name) + strlen(ext) + 4 > size) - return (-1); -- strcpy(dirresult, dir); -+ sys_expandpath(dir, buf); -+ strcpy(dirresult, buf); - if (*dirresult && dirresult[strlen(dirresult)-1] != '/') - strcat(dirresult, "/"); - strcat(dirresult, name); @@ -250,16 +280,16 @@ int sys_open_absolute(const char *name, const char* ext, char *dirresult, char **nameresult, unsigned int size, int bin, int *fdp) |