[PD-cvs] externals/hcs folder_list.c,1.6,1.7
Hans-Christoph Steiner
eighthave at users.sourceforge.net
Mon Mar 27 05:06:32 CEST 2006
Update of /cvsroot/pure-data/externals/hcs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7985
Modified Files:
folder_list.c
Log Message:
got the full path working on windows... ug.. why is windows programming inevitably a total pain in the ass?
Index: folder_list.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/folder_list.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** folder_list.c 26 Mar 2006 23:48:04 -0000 1.6
--- folder_list.c 27 Mar 2006 03:06:29 -0000 1.7
***************
*** 37,46 ****
#ifdef _WIN32
! WIN32_FIND_DATA FindFileData;
HANDLE hFind;
DWORD errorNumber;
LPVOID lpErrorMessage;
! hFind = FindFirstFile(x->x_pattern->s_name, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
--- 37,55 ----
#ifdef _WIN32
! 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, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
***************
*** 66,71 ****
}
do {
! outlet_symbol( x->x_obj.ob_outlet, gensym(FindFileData.cFileName) );
! } while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
#else
--- 75,91 ----
}
do {
! 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
More information about the Pd-cvs
mailing list