Closed sweep-ai[bot] closed 1 year ago
if the ini file does not exist,you should use origin path instead
if the ini file does not exist,you should use origin path instead
Hi @czyt,
I decided to make the following changes:
File Path | Proposed Changes |
---|---|
src/portable.h |
Modify src/portable.h with contents: • In the GetUserDataDir() function, before calling GetPrivateProfileStringW() , add a check to see if the ini file exists using the PathFileExists() function. If the ini file does not exist, return the original path GetAppDir() + L"\\..\\Data" .• Similarly, in the GetDiskCacheDir() function, before calling GetPrivateProfileStringW() , add a check to see if the ini file exists using the PathFileExists() function. If the ini file does not exist, return the original path GetAppDir() + L"\\..\\Cache" . |
PR Feedback (click)
Description
This PR adds support to read configuration options from an ini file in the project. The ini file will be located in the same directory as the binary. The ini file will contain options for UserData and CacheDir.
Summary of Changes
src/portable.h
to read UserData and CacheDir paths from the ini file usingGetPrivateProfileStringW
.GetUserDataDir()
andGetDiskCacheDir()
functions with calls toGetPrivateProfileStringW
.GetModuleFileName
to get the path of the executable file and appended the ini file name to it to get the full path of the ini file.GetPrivateProfileStringW
.Fixes #14.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: