mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-09 20:05:12 +00:00
Make SaveFile$ return "C" on cancel
This commit is contained in:
parent
5b987d52a8
commit
3b44191330
|
@ -20292,33 +20292,36 @@ end sub
|
||||||
' Download = MKI$(0) 'still working
|
' Download = MKI$(0) 'still working
|
||||||
'END FUNCTION
|
'END FUNCTION
|
||||||
|
|
||||||
Function SaveFile$ (IdeOpenFile as string)
|
FUNCTION SaveFile$ (IdeOpenFile AS STRING)
|
||||||
STATIC Default_StartDir$
|
STATIC Default_StartDir$
|
||||||
|
|
||||||
IF Default_StartDir$ = "" THEN
|
IF Default_StartDir$ = "" THEN
|
||||||
Default_StartDir$ = _STARTDIR$
|
Default_StartDir$ = _STARTDIR$
|
||||||
if Right$(Default_StartDir$, 1) <> idepathsep$ then Default_StartDir$ = Default_StartDir$ + idepathsep$
|
IF RIGHT$(Default_StartDir$, 1) <> idepathsep$ THEN Default_StartDir$ = Default_StartDir$ + idepathsep$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
f$ = _SaveFileDialog$("Save As", Default_StartDir$ + path$ + IdeOpenFile, ".bas", "QB64PE BAS file")
|
f$ = _SAVEFILEDIALOG$("Save As", Default_StartDir$ + path$ + IdeOpenFile, ".bas", "QB64PE BAS file")
|
||||||
if f$ = "" THEN EXIT FUNCTION 'someone canceled the input.
|
IF f$ = "" THEN
|
||||||
IF FileHasExtension(f$) = 0 THEN f$ = f$ + ".bas"
|
SaveFile$ = "C"
|
||||||
path$ = idezgetfilepath$(ideroot$, f$)
|
EXIT FUNCTION 'someone canceled the input.
|
||||||
pathseppos = _INSTRREV(f$, idepathsep$)
|
END IF
|
||||||
IF pathseppos > 0 THEN f$ = Mid$(f$, pathseppos +1)
|
|
||||||
|
|
||||||
ideerror = 3
|
|
||||||
OPEN path$ + idepathsep$ + f$ FOR BINARY AS #150
|
|
||||||
ideerror = 1
|
|
||||||
ideprogname$ = f$: _TITLE ideprogname + " - " + WindowTitle
|
|
||||||
idesave path$ + idepathsep$ + f$
|
|
||||||
idepath$ = path$
|
|
||||||
IdeAddRecent path$ + idepathsep$ + f$
|
|
||||||
IdeSaveBookmarks path$ + idepathsep$ + f$
|
|
||||||
CLOSE #150
|
|
||||||
end sub
|
|
||||||
|
|
||||||
|
IF FileHasExtension(f$) = 0 THEN f$ = f$ + ".bas"
|
||||||
|
path$ = idezgetfilepath$(ideroot$, f$)
|
||||||
|
pathseppos = _INSTRREV(f$, idepathsep$)
|
||||||
|
IF pathseppos > 0 THEN f$ = MID$(f$, pathseppos + 1)
|
||||||
|
|
||||||
|
ideerror = 3
|
||||||
|
OPEN path$ + idepathsep$ + f$ FOR BINARY AS #150
|
||||||
|
ideerror = 1
|
||||||
|
ideprogname$ = f$
|
||||||
|
_TITLE ideprogname$ + " - " + WindowTitle
|
||||||
|
idesave path$ + idepathsep$ + f$
|
||||||
|
idepath$ = path$
|
||||||
|
IdeAddRecent path$ + idepathsep$ + f$
|
||||||
|
IdeSaveBookmarks path$ + idepathsep$ + f$
|
||||||
|
CLOSE #150
|
||||||
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
Function OpenFile$ (IdeOpenFile as string)'load routine copied/pasted from the old IDE file load/save dialog routines
|
Function OpenFile$ (IdeOpenFile as string)'load routine copied/pasted from the old IDE file load/save dialog routines
|
||||||
|
|
Loading…
Reference in a new issue