Skip to content

Commit

Permalink
Fix error when running untwine not in single file mode (fixes hobuinc#77
Browse files Browse the repository at this point in the history
)

First create parent output dir before creating temp sub-dir in it
  • Loading branch information
wonder-sk committed Sep 29, 2021
1 parent 0a026d1 commit 7acf573
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions untwine/Untwine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ bool handleOptions(pdal::StringList& arglist, Options& options)

void createDirs(const Options& options)
{
if (pdal::FileUtils::fileExists(options.tempDir) &&
!pdal::FileUtils::isDirectory(options.tempDir))
fatal("Can't use temp directory - exists as a regular or special file.");
if (options.cleanTempDir)
pdal::FileUtils::deleteDirectory(options.tempDir);
if (!pdal::FileUtils::createDirectory(options.tempDir))
fatal("Couldn't create temp directory: '" + options.tempDir + "'.");

if (!options.singleFile)
{
if (!pdal::FileUtils::createDirectory(options.outputName))
Expand All @@ -117,6 +109,14 @@ void createDirs(const Options& options)
pdal::FileUtils::createDirectory(options.outputName + "/ept-data");
pdal::FileUtils::createDirectory(options.outputName + "/ept-hierarchy");
}

if (pdal::FileUtils::fileExists(options.tempDir) &&
!pdal::FileUtils::isDirectory(options.tempDir))
fatal("Can't use temp directory - exists as a regular or special file.");
if (options.cleanTempDir)
pdal::FileUtils::deleteDirectory(options.tempDir);
if (!pdal::FileUtils::createDirectory(options.tempDir))
fatal("Couldn't create temp directory: '" + options.tempDir + "'.");
}

} // namespace untwine
Expand Down

0 comments on commit 7acf573

Please sign in to comment.