Skip to content

Commit

Permalink
Resolve #4565: Add option to specify an absolute path to a map as sta…
Browse files Browse the repository at this point in the history
…rtup argument
  • Loading branch information
codereader committed Jul 14, 2017
1 parent 004cee8 commit 0cfd541
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions radiant/map/StartupMapLoader.cpp
Expand Up @@ -39,18 +39,26 @@ void StartupMapLoader::onRadiantStartup()
if (os::getExtension(candidate) != "map") continue;

// We have a map file, check if it exists (and where)

// First, look if we have an absolute map path
if (boost::filesystem::exists(candidate))
{
mapToLoad = candidate;
break;
}

boost::filesystem::path mapsPath = GlobalRegistry().get(RKEY_MAP_PATH);

boost::filesystem::path fullMapPath = mapsPath / candidate;

// First, look in the regular maps path
// Next, look in the regular maps path
if (boost::filesystem::exists(fullMapPath))
{
mapToLoad = fullMapPath.string();
break;
}

// Second, check for mod-relative paths
// Check for mod-relative paths too
fullMapPath = mapsPath.remove_leaf().remove_leaf() / candidate;

if (boost::filesystem::exists(fullMapPath))
Expand Down

0 comments on commit 0cfd541

Please sign in to comment.