317 cfgdir->setPath(*cConfigDir); |
317 cfgdir->setPath(*cConfigDir); |
318 |
318 |
319 if(cConfigDir->length() == 0) |
319 if(cConfigDir->length() == 0) |
320 { |
320 { |
321 #ifdef __APPLE__ |
321 #ifdef __APPLE__ |
322 if (checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars")) |
322 checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"); |
323 { |
|
324 checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Demos"); |
|
325 checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Saves"); |
|
326 checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Screenshots"); |
|
327 checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Teams"); |
|
328 } |
|
329 cfgdir->cd("Library/Application Support/Hedgewars"); |
323 cfgdir->cd("Library/Application Support/Hedgewars"); |
330 #elif defined _WIN32 |
324 #elif defined _WIN32 |
331 char path[1024]; |
325 char path[1024]; |
332 if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path)) |
326 if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path)) |
333 { |
327 { |
334 cfgdir->cd(path); |
328 cfgdir->cd(path); |
335 if (checkForDir(cfgdir->absolutePath() + "/Hedgewars")) |
329 checkForDir(cfgdir->absolutePath() + "/Hedgewars"); |
336 { |
|
337 checkForDir(cfgdir->absolutePath() + "/Hedgewars/Demos"); |
|
338 checkForDir(cfgdir->absolutePath() + "/Hedgewars/Saves"); |
|
339 checkForDir(cfgdir->absolutePath() + "/Hedgewars/Screenshots"); |
|
340 checkForDir(cfgdir->absolutePath() + "/Hedgewars/Teams"); |
|
341 } |
|
342 cfgdir->cd("Hedgewars"); |
330 cfgdir->cd("Hedgewars"); |
343 } |
331 } |
344 else |
332 else // couldn't retrieve documents folder? almost impossible, but in case fall back to classic path |
345 { |
333 { |
346 if (checkForDir(cfgdir->absolutePath() + "/.hedgewars")) |
334 checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
347 { |
|
348 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos"); |
|
349 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves"); |
|
350 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Screenshots"); |
|
351 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Teams"); |
|
352 } |
|
353 cfgdir->cd(".hedgewars"); |
335 cfgdir->cd(".hedgewars"); |
354 } |
336 } |
355 #else |
337 #else |
356 if (checkForDir(cfgdir->absolutePath() + "/.hedgewars")) |
338 checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
357 { |
|
358 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos"); |
|
359 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves"); |
|
360 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Screenshots"); |
|
361 checkForDir(cfgdir->absolutePath() + "/.hedgewars/Teams"); |
|
362 } |
|
363 cfgdir->cd(".hedgewars"); |
339 cfgdir->cd(".hedgewars"); |
364 #endif |
340 #endif |
365 } |
341 } |
366 else |
342 |
|
343 if (checkForDir(cfgdir->absolutePath())) |
367 { |
344 { |
368 if (checkForDir(cfgdir->absolutePath())) |
345 // alternative loading/lookup paths |
369 { |
346 // TODO: Uncomment paths as they're implemented |
370 checkForDir(cfgdir->absolutePath() + "/Demos"); |
347 checkForDir(cfgdir->absolutePath() + "/Data"); |
371 checkForDir(cfgdir->absolutePath() + "/Saves"); |
348 //checkForDir(cfgdir->absolutePath() + "/Data/Forts"); |
372 checkForDir(cfgdir->absolutePath() + "/Screenshots"); |
349 //checkForDir(cfgdir->absolutePath() + "/Data/Graphics"); |
373 checkForDir(cfgdir->absolutePath() + "/Teams"); |
350 //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Flags"); |
374 } |
351 //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Graves"); |
375 } |
352 //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Hats"); |
376 |
353 //checkForDir(cfgdir->absolutePath() + "/Data/Maps"); |
|
354 //checkForDir(cfgdir->absolutePath() + "/Data/Missions"); |
|
355 //checkForDir(cfgdir->absolutePath() + "/Data/Missions/Campaign"); |
|
356 //checkForDir(cfgdir->absolutePath() + "/Data/Missions/Training"); |
|
357 //checkForDir(cfgdir->absolutePath() + "/Data/Sounds"); |
|
358 //checkForDir(cfgdir->absolutePath() + "/Data/Sounds/voices"); |
|
359 //checkForDir(cfgdir->absolutePath() + "/Data/Themes"); |
|
360 |
|
361 // config/save paths |
|
362 checkForDir(cfgdir->absolutePath() + "/Demos"); |
|
363 checkForDir(cfgdir->absolutePath() + "/Saves"); |
|
364 checkForDir(cfgdir->absolutePath() + "/Screenshots"); |
|
365 checkForDir(cfgdir->absolutePath() + "/Teams"); |
|
366 } |
377 |
367 |
378 datadir->cd(bindir->absolutePath()); |
368 datadir->cd(bindir->absolutePath()); |
379 datadir->cd(*cDataDir); |
369 datadir->cd(*cDataDir); |
380 if(!datadir->cd("hedgewars/Data")) { |
370 if(!datadir->cd("hedgewars/Data")) { |
381 QMessageBox::critical(0, QMessageBox::tr("Error"), |
371 QMessageBox::critical(0, QMessageBox::tr("Error"), |