Skip to content

Commit

Permalink
Windows related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Talv committed Jul 26, 2019
1 parent f44a042 commit d43b155
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/bin")

set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

set(CMAKE_CXX_FLAGS "-std=c++11")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
Expand Down
2 changes: 1 addition & 1 deletion include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "mplog/ColorConsoleAppenderStderr.h"
// #include "plog/Formatters/FuncMessageFormatter.h"

static const std::string stormexVersion = "2.0.0";
static const std::string stormexVersion = "2.0.1";

static plog::ColorConsoleAppenderStdErr<plog::TxtFormatter> consoleAppender;
// static plog::ColorConsoleAppender<plog::FuncMessageFormatter> consoleAppender;
Expand Down
6 changes: 3 additions & 3 deletions src/stormex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void parseArguments(int argc, char* argv[])
("X,extract-file",
"Extract file(s) matching exactly.",
cxxopts::value<std::vector<std::string>>(appCtx.m_extract.xFilenames), "[FILE...]")
("o,outdir", "Output directory for extracted files.", cxxopts::value<std::string>(appCtx.m_extract.outDir)->default_value("./"), "[PATH]")
("o,outdir", "Output directory for extracted files.", cxxopts::value<std::string>(appCtx.m_extract.outDir)->default_value("."), "[PATH]")
("p,stdout", "Pipe content of a file(s) to stdout instead writing it to the filesystem.", cxxopts::value<bool>(appCtx.m_extract.stdOut))
("P,progress", "Notify about progress during extraction.", cxxopts::value<bool>(appCtx.m_extract.progress))
("n,dry-run", "Simulate extraction process without writing any data to the filesystem.", cxxopts::value<bool>(appCtx.m_extract.dryRun));
Expand Down Expand Up @@ -194,7 +194,7 @@ void extractFilenames(StorageExplorer& stExplorer, const std::vector<std::string

for (const auto& storedFilename : filesToExtract) {
std::string targetFile = appCtx.m_extract.outDir;
if (targetFile.at(targetFile.size() - 1) != PATH_SEP_CHAR) {
if (targetFile.at(targetFile.size() - 1) != '\\' && targetFile.at(targetFile.size() - 1) != '/') {
targetFile += PATH_SEP_STR;
}
targetFile += storedFilename;
Expand All @@ -207,7 +207,7 @@ void extractFilenames(StorageExplorer& stExplorer, const std::vector<std::string
size_t fileSize = 0;
if (!appCtx.m_extract.dryRun) {
// normalize slashes in the paths received from CASC and force '/'
std::replace(targetFile.begin(), targetFile.end(), '\\', PATH_SEP_CHAR);
std::replace(targetFile.begin(), targetFile.end(), '\\', '/');

fileSize = stExplorer.extractFileToPath(storedFilename, targetFile);
PLOG_DEBUG << "Written " << formatFileSize(fileSize) << " to " << targetFile;
Expand Down
2 changes: 2 additions & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <regex>
#include <cctype>
#include "util.hpp"

struct stat info;
Expand Down

0 comments on commit d43b155

Please sign in to comment.