代码拉取完成,页面将自动刷新
; --------------------------------------------------------------------------------------------
; Copyright (c) Fantaisie Software. All rights reserved.
; Dual licensed under the GPL and Fantaisie Software licenses.
; See LICENSE and LICENSE-FANTAISIE in the project root for license information.
; --------------------------------------------------------------------------------------------
; -----------------------------------------------------------------
;
; Returns the Path where to store PureBasic specific config files
; On Windows : %UsersDir%\ApplicationData\PureBasic
; On Linux/Mac: %home%\.purebasic\
;
; Also ensures that the returned path exists.
;
; This function should be used by all tools in the PureBasic package
; to ensure a consistent place where config files are stored.
;
; -----------------------------------------------------------------
CompilerIf Not Defined(SpiderBasic, #PB_Constant)
#SpiderBasic = 0
CompilerEndIf
Procedure.s PureBasicConfigPath()
Static ConfigPath$
; We cache the value for multiple uses within a program
If ConfigPath$ <> ""
ProcedureReturn ConfigPath$
EndIf
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected pidl, Index
#CSIDL_APPDATA = $001a
ConfigPath$ = GetHomeDirectory() ; fallback option if the below fails (no IE4 present)
If SHGetSpecialFolderLocation_(0, #CSIDL_APPDATA, @pidl) = #S_OK
ConfigPath$ = Space(#MAX_PATH)
If SHGetPathFromIDList_(pidl, @ConfigPath$) = 0
ConfigPath$ = GetHomeDirectory()
EndIf
EndIf
CompilerIf #SpiderBasic
If Right(ConfigPath$, 1) <> "\"
ConfigPath$ + "\SpiderBasic\"
Else
ConfigPath$ + "SpiderBasic\"
EndIf
CompilerElse
If Right(ConfigPath$, 1) <> "\"
ConfigPath$ + "\PureBasic\"
Else
ConfigPath$ + "PureBasic\"
EndIf
CompilerEndIf
; Ensure that the path exists
; Must check all parents too, as CreateDirectory() fails else
;
If FileSize(ConfigPath$) <> -2
Index = 3 ; the drive surely exists
While FindString(ConfigPath$, "\", Index+1) > 0
Index = FindString(ConfigPath$, "\", Index+1)
If FileSize(Left(ConfigPath$, Index)) <> -2
If CreateDirectory(Left(ConfigPath$, Index)) = 0
Break
EndIf
EndIf
Wend
EndIf
CompilerElse
CompilerIf #SpiderBasic
ConfigPath$ = GetHomeDirectory() + ".spiderbasic/"
CompilerElse
ConfigPath$ = GetHomeDirectory() + ".purebasic/"
CompilerEndIf
; Note: no recursive creation needed here, as the home dir should
; be existent already and we go only one level below that.
;
If FileSize(ConfigPath$) <> -2
CreateDirectory(ConfigPath$)
EndIf
CompilerEndIf
ProcedureReturn ConfigPath$
EndProcedure
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。