aboutsummaryrefslogtreecommitdiff
path: root/folder_list.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-03-27 03:06:29 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-03-27 03:06:29 +0000
commit07c0b4c96a5a6fb5a95507d1ed85193574395aab (patch)
tree96005d630abcc3739ce24d7104f83f4a40174af9 /folder_list.c
parent1074fd02b0d83cb7d13b1f649e1fab5a371fd634 (diff)
got the full path working on windows... ug.. why is windows programming inevitably a total pain in the ass?
svn path=/trunk/externals/hcs/; revision=4779
Diffstat (limited to 'folder_list.c')
-rw-r--r--folder_list.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/folder_list.c b/folder_list.c
index e189dd2..fdf7935 100644
--- a/folder_list.c
+++ b/folder_list.c
@@ -9,7 +9,7 @@
#include <glob.h>
#endif
-static char *version = "$Revision: 1.6 $";
+static char *version = "$Revision: 1.7 $";
#define DEBUG(x)
//#define DEBUG(x) x
@@ -36,12 +36,21 @@ static void folder_list_output(t_folder_list* x)
DEBUG(post("folder_list_output"););
#ifdef _WIN32
- WIN32_FIND_DATA FindFileData;
+ WIN32_FIND_DATA findData;
HANDLE hFind;
DWORD errorNumber;
LPVOID lpErrorMessage;
+ char fullPathNameBuffer[MAX_PATH+1] = "";
+ char unbashBuffer[MAX_PATH+1] = "";
+ char pathBuffer[MAX_PATH+1] = "";
+ int length;
+
+// arg, looks perfect, but only in Windows Vista
+// GetFinalPathNameByHandle(hFind,fullPathNameBuffer,MAX_PATH,FILE_NAME_NORMALIZED);
+ GetFullPathName(x->x_pattern->s_name,MAX_PATH,fullPathNameBuffer,NULL);
+ sys_unbashfilename(fullPathNameBuffer,unbashBuffer);
- hFind = FindFirstFile(x->x_pattern->s_name, &FindFileData);
+ hFind = FindFirstFile(x->x_pattern->s_name, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
errorNumber = GetLastError();
@@ -65,8 +74,19 @@ static void folder_list_output(t_folder_list* x)
return;
}
do {
- outlet_symbol( x->x_obj.ob_outlet, gensym(FindFileData.cFileName) );
- } while (FindNextFile(hFind, &FindFileData) != 0);
+ if( strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, "..") )
+ {
+ length = strlen(unbashBuffer);
+ do
+ {
+ length--;
+ } while ( *(unbashBuffer + length) == '/' );
+ strncpy(pathBuffer, unbashBuffer, length);
+ pathBuffer[length] = '\0';
+ strcat(pathBuffer,findData.cFileName);
+ outlet_symbol( x->x_obj.ob_outlet, gensym(pathBuffer) );
+ }
+ } while (FindNextFile(hFind, &findData) != 0);
FindClose(hFind);
#else
unsigned int i;