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

Function CheckIniFile

src/Notepad2.c:5098–5129  ·  view source on GitHub ↗

============================================================================= FindIniFile()

Source from the content-addressed store, hash-verified

5096//
5097//
5098int CheckIniFile ( LPWSTR lpszFile, LPCWSTR lpszModule )
5099{
5100 WCHAR tchFileExpanded[MAX_PATH];
5101 WCHAR tchBuild[MAX_PATH];
5102 ExpandEnvironmentStrings ( lpszFile, tchFileExpanded, COUNTOF ( tchFileExpanded ) );
5103 if ( PathIsRelative ( tchFileExpanded ) ) {
5104 // program directory
5105 lstrcpy ( tchBuild, lpszModule );
5106 lstrcpy ( PathFindFileName ( tchBuild ), tchFileExpanded );
5107 if ( PathFileExists ( tchBuild ) ) {
5108 lstrcpy ( lpszFile, tchBuild );
5109 return ( 1 );
5110 }
5111 // %appdata%
5112 if ( S_OK == SHGetFolderPath ( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild ) ) {
5113 PathAppend ( tchBuild, tchFileExpanded );
5114 if ( PathFileExists ( tchBuild ) ) {
5115 lstrcpy ( lpszFile, tchBuild );
5116 return ( 1 );
5117 }
5118 }
5119 // general
5120 if ( SearchPath ( NULL, tchFileExpanded, NULL, COUNTOF ( tchBuild ), tchBuild, NULL ) ) {
5121 lstrcpy ( lpszFile, tchBuild );
5122 return ( 1 );
5123 }
5124 } else if ( PathFileExists ( tchFileExpanded ) ) {
5125 lstrcpy ( lpszFile, tchFileExpanded );
5126 return ( 1 );
5127 }
5128 return ( 0 );
5129}
5130int CheckIniFileRedirect ( LPWSTR lpszFile, LPCWSTR lpszModule )
5131{
5132 WCHAR tch[MAX_PATH];

Callers 2

CheckIniFileRedirectFunction · 0.85
FindIniFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected