MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / FindIniFile

Function FindIniFile

src/Notepad2.c:5152–5192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5150 return ( 0 );
5151}
5152int FindIniFile()
5153{
5154 int bFound = 0;
5155 WCHAR tchTest[MAX_PATH];
5156 WCHAR tchModule[MAX_PATH];
5157 GetModuleFileName ( NULL, tchModule, COUNTOF ( tchModule ) );
5158 if ( lstrlen ( szIniFile ) ) {
5159 if ( lstrcmpi ( szIniFile, L"*?" ) == 0 ) {
5160 return ( 0 );
5161 } else {
5162 if ( !CheckIniFile ( szIniFile, tchModule ) ) {
5163 ExpandEnvironmentStringsEx ( szIniFile, COUNTOF ( szIniFile ) );
5164 if ( PathIsRelative ( szIniFile ) ) {
5165 lstrcpy ( tchTest, tchModule );
5166 PathRemoveFileSpec ( tchTest );
5167 PathAppend ( tchTest, szIniFile );
5168 lstrcpy ( szIniFile, tchTest );
5169 }
5170 }
5171 }
5172 return ( 1 );
5173 }
5174 lstrcpy ( tchTest, PathFindFileName ( tchModule ) );
5175 PathRenameExtension ( tchTest, L".ini" );
5176 bFound = CheckIniFile ( tchTest, tchModule );
5177 if ( !bFound ) {
5178 lstrcpy ( tchTest, L"Notepad2.ini" );
5179 bFound = CheckIniFile ( tchTest, tchModule );
5180 }
5181 if ( bFound ) {
5182 // allow two redirections: administrator -> user -> custom
5183 if ( CheckIniFileRedirect ( tchTest, tchModule ) ) {
5184 CheckIniFileRedirect ( tchTest, tchModule );
5185 }
5186 lstrcpy ( szIniFile, tchTest );
5187 } else {
5188 lstrcpy ( szIniFile, tchModule );
5189 PathRenameExtension ( szIniFile, L".ini" );
5190 }
5191 return ( 1 );
5192}
5193int TestIniFile()
5194{
5195 if ( lstrcmpi ( szIniFile, L"*?" ) == 0 ) {

Callers 1

WinMainFunction · 0.85

Calls 3

CheckIniFileFunction · 0.85
CheckIniFileRedirectFunction · 0.85

Tested by

no test coverage detected