mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-09 18:55:12 +00:00
Fix #124
This commit is contained in:
parent
bdcc41e382
commit
5bd3192491
|
@ -4140,25 +4140,21 @@ DO
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
|
og_libpath$ = libpath$ ' save the original libpath
|
||||||
|
|
||||||
'Accept ./ and .\ as a reference to the source file
|
'Accept ./ and .\ as a reference to the source file
|
||||||
'folder, replacing it with the actual full path, if available
|
'folder, replacing it with the actual full path, if available
|
||||||
IF libpath$ = "./" OR libpath$ = ".\" THEN
|
IF libpath$ = "./" OR libpath$ = ".\" THEN
|
||||||
libpath$ = ""
|
libpath$ = ""
|
||||||
IF NoIDEMode THEN
|
IF NoIDEMode THEN
|
||||||
libpath$ = path.source$
|
libpath$ = FixDirectoryName(path.source$)
|
||||||
IF LEN(libpath$) > 0 AND RIGHT$(libpath$, 1) <> pathsep$ THEN libpath$ = libpath$ + pathsep$
|
|
||||||
ELSE
|
ELSE
|
||||||
IF LEN(ideprogname) THEN libpath$ = idepath$ + pathsep$
|
IF LEN(ideprogname) THEN libpath$ = idepath$ + pathsep$
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'Create a path which can be used for inline code (uses \\ instead of \)
|
'Create a path which can be used for inline code (uses \\ instead of \)
|
||||||
libpath_inline$ = ""
|
libpath_inline$ = GetEscapedPath(libpath$)
|
||||||
FOR z = 1 TO LEN(libpath$)
|
|
||||||
a = ASC(libpath$, z)
|
|
||||||
libpath_inline$ = libpath_inline$ + CHR$(a)
|
|
||||||
IF a = 92 THEN libpath_inline$ = libpath_inline$ + "\"
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
IF LEN(x$) THEN
|
IF LEN(x$) THEN
|
||||||
IF dynamiclibrary = 0 THEN
|
IF dynamiclibrary = 0 THEN
|
||||||
|
@ -4475,6 +4471,21 @@ DO
|
||||||
sfheader = 1
|
sfheader = 1
|
||||||
GOTO GotHeader
|
GOTO GotHeader
|
||||||
END IF
|
END IF
|
||||||
|
' a740g: Fallback to source path
|
||||||
|
libpath$ = FixDirectoryName(idepath$) + og_libpath$
|
||||||
|
libpath_inline$ = GetEscapedPath(libpath$)
|
||||||
|
IF _FILEEXISTS(libpath$ + x$ + ".h") THEN
|
||||||
|
headername$ = libpath_inline$ + x$ + ".h"
|
||||||
|
IF customtypelibrary = 0 THEN sfdeclare = 0
|
||||||
|
sfheader = 1
|
||||||
|
GOTO GotHeader
|
||||||
|
END IF
|
||||||
|
IF _FILEEXISTS(libpath$ + x$ + ".hpp") THEN
|
||||||
|
headername$ = libpath_inline$ + x$ + ".hpp"
|
||||||
|
IF customtypelibrary = 0 THEN sfdeclare = 0
|
||||||
|
sfheader = 1
|
||||||
|
GOTO GotHeader
|
||||||
|
END IF
|
||||||
END IF 'Windows
|
END IF 'Windows
|
||||||
|
|
||||||
IF os$ = "LNX" THEN
|
IF os$ = "LNX" THEN
|
||||||
|
@ -4527,6 +4538,21 @@ DO
|
||||||
sfheader = 1
|
sfheader = 1
|
||||||
GOTO GotHeader
|
GOTO GotHeader
|
||||||
END IF
|
END IF
|
||||||
|
' a740g: Fallback to source path
|
||||||
|
libpath$ = FixDirectoryName(idepath$) + og_libpath$
|
||||||
|
libpath_inline$ = GetEscapedPath(libpath$)
|
||||||
|
IF _FILEEXISTS(libpath$ + x$ + ".h") THEN
|
||||||
|
headername$ = libpath_inline$ + x$ + ".h"
|
||||||
|
IF customtypelibrary = 0 THEN sfdeclare = 0
|
||||||
|
sfheader = 1
|
||||||
|
GOTO GotHeader
|
||||||
|
END IF
|
||||||
|
IF _FILEEXISTS(libpath$ + x$ + ".hpp") THEN
|
||||||
|
headername$ = libpath_inline$ + x$ + ".hpp"
|
||||||
|
IF customtypelibrary = 0 THEN sfdeclare = 0
|
||||||
|
sfheader = 1
|
||||||
|
GOTO GotHeader
|
||||||
|
END IF
|
||||||
END IF 'Linux
|
END IF 'Linux
|
||||||
|
|
||||||
GotHeader:
|
GotHeader:
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
'
|
'
|
||||||
' Returns: 0 on success, 1 on error
|
' Returns: 0 on success, 1 on error
|
||||||
FUNCTION CopyFile& (sourceFile$, destFile$)
|
FUNCTION CopyFile& (sourceFile$, destFile$)
|
||||||
DIM sourcefileNo, destFileNo
|
DIM sourceFileNo, destFileNo
|
||||||
DIM fileLength AS _INTEGER64
|
DIM fileLength AS _INTEGER64
|
||||||
|
|
||||||
E = 0
|
E = 0
|
||||||
sourceFileNo = FREEFILE
|
sourceFileNo = FREEFILE
|
||||||
OPEN sourceFile$ FOR BINARY as #sourceFileNo
|
OPEN sourceFile$ FOR BINARY AS #sourceFileNo
|
||||||
if E = 1 THEN GOTO errorCleanup
|
IF E = 1 THEN GOTO errorCleanup
|
||||||
|
|
||||||
fileLength = LOF(sourceFileNo)
|
fileLength = LOF(sourceFileNo)
|
||||||
|
|
||||||
destFileNo = FREEFILE
|
destFileNo = FREEFILE
|
||||||
OPEN destFile$ FOR BINARY as #destFileNo
|
OPEN destFile$ FOR BINARY AS #destFileNo
|
||||||
if E = 1 THEN GOTO errorCleanup
|
IF E = 1 THEN GOTO errorCleanup
|
||||||
|
|
||||||
' Read the file in one go
|
' Read the file in one go
|
||||||
buffer$ = SPACE$(fileLength)
|
buffer$ = SPACE$(fileLength)
|
||||||
|
@ -24,7 +24,7 @@ FUNCTION CopyFile& (sourceFile$, destFile$)
|
||||||
GET #sourceFileNo, , buffer$
|
GET #sourceFileNo, , buffer$
|
||||||
PUT #destFileNo, , buffer$
|
PUT #destFileNo, , buffer$
|
||||||
|
|
||||||
errorCleanup:
|
errorCleanup:
|
||||||
IF sourceFileNo <> 0 THEN CLOSE #sourceFileNo
|
IF sourceFileNo <> 0 THEN CLOSE #sourceFileNo
|
||||||
IF destFileNo <> 0 THEN CLOSE #destFileNo
|
IF destFileNo <> 0 THEN CLOSE #destFileNo
|
||||||
|
|
||||||
|
@ -99,3 +99,26 @@ SUB PATH_SLASH_CORRECT (a$)
|
||||||
NEXT
|
NEXT
|
||||||
END IF
|
END IF
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
' Return a pathname where all "\" are correctly escaped
|
||||||
|
FUNCTION GetEscapedPath$ (path_name AS STRING)
|
||||||
|
DIM buf AS STRING, z AS _UNSIGNED LONG, a AS _UNSIGNED _BYTE
|
||||||
|
|
||||||
|
FOR z = 1 TO LEN(path_name)
|
||||||
|
a = ASC(path_name, z)
|
||||||
|
buf = buf + CHR$(a)
|
||||||
|
IF a = 92 THEN buf = buf + "\"
|
||||||
|
NEXT
|
||||||
|
|
||||||
|
GetEscapedPath = buf
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
' Adds a trailing \ or / if to the name if needed
|
||||||
|
FUNCTION FixDirectoryName$ (dir_name AS STRING)
|
||||||
|
IF LEN(dir_name) > 0 AND RIGHT$(dir_name, 1) <> pathsep$ THEN
|
||||||
|
FixDirectoryName = dir_name + pathsep$
|
||||||
|
ELSE
|
||||||
|
FixDirectoryName = dir_name
|
||||||
|
END IF
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue