MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / EnumConfigPaths

Function EnumConfigPaths

Libraries/unrar/pathfn.cpp:263–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261
262#ifndef SFX_MODULE
263bool EnumConfigPaths(uint Number,wchar *Path,size_t MaxSize,bool Create)
264{
265#ifdef _UNIX
266 static const wchar *ConfPath[]={
267 L"/etc", L"/etc/rar", L"/usr/lib", L"/usr/local/lib", L"/usr/local/etc"
268 };
269 if (Number==0)
270 {
271 char *EnvStr=getenv("HOME");
272 if (EnvStr!=NULL)
273 CharToWide(EnvStr,Path,MaxSize);
274 else
275 wcsncpyz(Path,ConfPath[0],MaxSize);
276 return true;
277 }
278 Number--;
279 if (Number>=ASIZE(ConfPath))
280 return false;
281 wcsncpyz(Path,ConfPath[Number], MaxSize);
282 return true;
283#elif defined(_WIN_ALL)
284 if (Number>1)
285 return false;
286 if (Number==0)
287 GetRarDataPath(Path,MaxSize,Create);
288 else
289 {
290 GetModuleFileName(NULL,Path,(DWORD)MaxSize);
291 RemoveNameFromPath(Path);
292 }
293 return true;
294#else
295 return false;
296#endif
297}
298#endif
299
300

Callers 1

GetConfigNameFunction · 0.85

Calls 4

CharToWideFunction · 0.85
wcsncpyzFunction · 0.85
GetRarDataPathFunction · 0.85
RemoveNameFromPathFunction · 0.85

Tested by

no test coverage detected