# set this to your email address (perl will guess a value from
# from your loginname and your hostname, which may not be right)
#
-#EMAIL =
+#EMAIL =
##
## Build configuration ends.
CC = cl
LINK32 = link
LIB32 = $(LINK32) -lib
+RSC = rc
#
# Options
! ENDIF
!ENDIF
+PERLEXE_RES =
+PERLDLL_RES =
+
!IF "$(RUNTIME)" == "-MD"
LIBC = $(PERLCRTLIBC)
!ELSE
# Rules
#
-.SUFFIXES : .c $(o) .dll .lib .exe
+.SUFFIXES : .c $(o) .dll .lib .exe .rc .res
.c$(o):
$(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
$(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
-out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
+.rc.res:
+ $(RSC) $<
+
#
# various targets
!IF "$(USE_OBJECT)" == "define"
$(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
CCTYPE=$(CCTYPE) > perldll.def
-$(PERLDLL): perldll.def $(PERLDLL_OBJ)
+$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES)
$(LINK32) -dll -def:perldll.def -out:$@ @<<
- $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ)
+ $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES)
<<
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
perlmain$(o) : perlmain.c
$(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
-$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
+$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
$(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \
- $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB)
+ $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
copy $(PERLEXE) $(WPERLEXE)
editbin /subsystem:windows $(WPERLEXE)
copy splittree.pl ..
# so you may have to set CCHOME explicitly (spaces in the path name should
# not be quoted)
#
-CCHOME *= d:\bc5
+CCHOME *= c:\bc5
#CCHOME *= $(MSVCDIR)
#CCHOME *= D:\packages\mingw32
CCINCDIR *= $(CCHOME)\include
LINK32 = tlink32
LIB32 = tlib /P128
IMPLIB = implib -c
+RSC = rc
#
# Options
LINK32 = gcc
LIB32 = ar rc
IMPLIB = dlltool
+RSC = rc
o = .o
a = .a
CC = cl
LINK32 = link
LIB32 = $(LINK32) -lib
+RSC = rc
#
# Options
.ENDIF
.ENDIF
+PERLEXE_RES =
+PERLDLL_RES =
+
.IF "$(RUNTIME)" == "-MD"
LIBC = $(PERLCRTLIBC)
.ELSE
# Rules
#
-.SUFFIXES : .c $(o) .dll $(a) .exe
+.SUFFIXES : .c $(o) .dll $(a) .exe .rc .res
.c$(o):
$(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
-out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
.ENDIF
+.rc.res:
+ $(RSC) $<
+
#
# various targets
MINIPERL = ..\miniperl.exe
$(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
$(BUILDOPT) CCTYPE=$(CCTYPE) > perldll.def
-$(PERLDLL): perldll.def $(PERLDLL_OBJ)
+$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES)
.IF "$(CCTYPE)" == "BORLAND"
$(LINK32) -Tpd -ap $(BLINK_FLAGS) \
@$(mktmp c0d32$(o) $(PERLDLL_OBJ:s,\,\\)\n \
perl.exp $(LKPOST))
.ELSE
$(LINK32) -dll -def:perldll.def -out:$@ \
- @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ:s,\,\\))
+ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,\\))
.ENDIF
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
perlmain$(o) : perlmain.c
$(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
-$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
+$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
.IF "$(CCTYPE)" == "BORLAND"
$(LINK32) -Tpe -ap $(BLINK_FLAGS) \
@$(mktmp c0x32$(o) $(PERLEXE_OBJ:s,\,\\)\n \
$(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES)
.ELSE
$(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) $(LIBFILES) \
- $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB)
+ $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
copy $(PERLEXE) $(WPERLEXE)
editbin /subsystem:windows $(WPERLEXE)
.ENDIF
HANDLE hHandle;
WIN32_FIND_DATA win32FD;
char szBuffer[MAX_PATH+1], *pPtr;
- int nRet = -1;
+ int length, nRet = -1;
GetFullPathNameA(MapPathA(lpBuffer), sizeof(szBuffer), szBuffer, &pPtr);
+ /* if the last char is a '\\' or a '/' then add
+ * an '*' before calling FindFirstFile
+ */
+ length = strlen(szBuffer);
+ if(length > 0 && IsPathSep(szBuffer[length-1])) {
+ szBuffer[length] = '*';
+ szBuffer[length+1] = '\0';
+ }
- hHandle = FindFirstFile(szBuffer, &win32FD);
+ hHandle = FindFirstFileA(szBuffer, &win32FD);
if (hHandle != INVALID_HANDLE_VALUE) {
FindClose(hHandle);
- SetDefaultDirA(szBuffer, DriveIndex(szBuffer[0]));
- nRet = 0;
- }
- return nRet;
-}
-
-int VDir::SetCurrentDirectoryW(WCHAR *lpBuffer)
-{
- HANDLE hHandle;
- WIN32_FIND_DATAW win32FD;
- WCHAR szBuffer[MAX_PATH+1], *pPtr;
- int nRet = -1;
- GetFullPathNameW(MapPathW(lpBuffer), (sizeof(szBuffer)/sizeof(WCHAR)), szBuffer, &pPtr);
+ /* if an '*' was added remove it */
+ if(szBuffer[length] == '*')
+ szBuffer[length] = '\0';
- hHandle = FindFirstFileW(szBuffer, &win32FD);
- if (hHandle != INVALID_HANDLE_VALUE) {
- FindClose(hHandle);
- SetDefaultDirW(szBuffer, DriveIndex((char)szBuffer[0]));
+ SetDefaultDirA(szBuffer, DriveIndex(szBuffer[0]));
nRet = 0;
}
return nRet;
return szLocalBufferW;
}
+int VDir::SetCurrentDirectoryW(WCHAR *lpBuffer)
+{
+ HANDLE hHandle;
+ WIN32_FIND_DATAW win32FD;
+ WCHAR szBuffer[MAX_PATH+1], *pPtr;
+ int length, nRet = -1;
+
+ GetFullPathNameW(MapPathW(lpBuffer), (sizeof(szBuffer)/sizeof(WCHAR)), szBuffer, &pPtr);
+ /* if the last char is a '\\' or a '/' then add
+ * an '*' before calling FindFirstFile
+ */
+ length = wcslen(szBuffer);
+ if(length > 0 && IsPathSep(szBuffer[length-1])) {
+ szBuffer[length] = '*';
+ szBuffer[length+1] = '\0';
+ }
+
+ hHandle = FindFirstFileW(szBuffer, &win32FD);
+ if (hHandle != INVALID_HANDLE_VALUE) {
+ FindClose(hHandle);
+
+ /* if an '*' was added remove it */
+ if(szBuffer[length] == '*')
+ szBuffer[length] = '\0';
+
+ SetDefaultDirW(szBuffer, DriveIndex((char)szBuffer[0]));
+ nRet = 0;
+ }
+ return nRet;
+}
#endif /* ___VDir_H___ */