; --------------------------------------------------------------------------------------------; 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 = 0CompilerEndIfProcedure.s PureBasicConfigPath()Static ConfigPath$; We cache the value for multiple uses within a programIf ConfigPath$ <> ""ProcedureReturn ConfigPath$EndIfCompilerIf #PB_Compiler_OS = #PB_OS_WindowsProtected pidl, Index#CSIDL_APPDATA = 001ドルaConfigPath$ = GetHomeDirectory() ; fallback option if the below fails (no IE4 present)If SHGetSpecialFolderLocation_(0, #CSIDL_APPDATA, @pidl) = #S_OKConfigPath$ = Space(#MAX_PATH)If SHGetPathFromIDList_(pidl, @ConfigPath$) = 0ConfigPath$ = GetHomeDirectory()EndIfEndIfCompilerIf #SpiderBasicIf Right(ConfigPath,ドル 1) <> "\"ConfigPath$ + "\SpiderBasic\"ElseConfigPath$ + "SpiderBasic\"EndIfCompilerElseIf Right(ConfigPath,ドル 1) <> "\"ConfigPath$ + "\PureBasic\"ElseConfigPath$ + "PureBasic\"EndIfCompilerEndIf; Ensure that the path exists; Must check all parents too, as CreateDirectory() fails else;If FileSize(ConfigPath$) <> -2Index = 3 ; the drive surely existsWhile FindString(ConfigPath,ドル "\", Index+1) > 0Index = FindString(ConfigPath,ドル "\", Index+1)If FileSize(Left(ConfigPath,ドル Index)) <> -2If CreateDirectory(Left(ConfigPath,ドル Index)) = 0BreakEndIfEndIfWendEndIfCompilerElseCompilerIf #SpiderBasicConfigPath$ = GetHomeDirectory() + ".spiderbasic/"CompilerElseConfigPath$ = 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$) <> -2CreateDirectory(ConfigPath$)EndIfCompilerEndIfProcedureReturn ConfigPath$EndProcedure
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。