Skip to content

Commit d43b155

Browse files
committed
Windows related fixes
1 parent f44a042 commit d43b155

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/bin")
55
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/lib")
66
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${STORMEXTRACT_BINARY_DIR}/bin")
77

8+
set(default_build_type "RelWithDebInfo")
9+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
10+
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
11+
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
12+
STRING "Choose the type of build." FORCE)
13+
# Set the possible values of build type for cmake-gui
14+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
15+
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
16+
endif()
17+
818
set(CMAKE_CXX_FLAGS "-std=c++11")
919
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
1020
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")

include/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "mplog/ColorConsoleAppenderStderr.h"
77
// #include "plog/Formatters/FuncMessageFormatter.h"
88

9-
static const std::string stormexVersion = "2.0.0";
9+
static const std::string stormexVersion = "2.0.1";
1010

1111
static plog::ColorConsoleAppenderStdErr<plog::TxtFormatter> consoleAppender;
1212
// static plog::ColorConsoleAppender<plog::FuncMessageFormatter> consoleAppender;

src/stormex.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void parseArguments(int argc, char* argv[])
124124
("X,extract-file",
125125
"Extract file(s) matching exactly.",
126126
cxxopts::value<std::vector<std::string>>(appCtx.m_extract.xFilenames), "[FILE...]")
127-
("o,outdir", "Output directory for extracted files.", cxxopts::value<std::string>(appCtx.m_extract.outDir)->default_value("./"), "[PATH]")
127+
("o,outdir", "Output directory for extracted files.", cxxopts::value<std::string>(appCtx.m_extract.outDir)->default_value("."), "[PATH]")
128128
("p,stdout", "Pipe content of a file(s) to stdout instead writing it to the filesystem.", cxxopts::value<bool>(appCtx.m_extract.stdOut))
129129
("P,progress", "Notify about progress during extraction.", cxxopts::value<bool>(appCtx.m_extract.progress))
130130
("n,dry-run", "Simulate extraction process without writing any data to the filesystem.", cxxopts::value<bool>(appCtx.m_extract.dryRun));
@@ -194,7 +194,7 @@ void extractFilenames(StorageExplorer& stExplorer, const std::vector<std::string
194194

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

212212
fileSize = stExplorer.extractFileToPath(storedFilename, targetFile);
213213
PLOG_DEBUG << "Written " << formatFileSize(fileSize) << " to " << targetFile;

src/util.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#include <iostream>
22
#include <iomanip>
3+
#include <sstream>
34
#include <algorithm>
45
#include <string>
56
#include <sys/stat.h>
67
#include <sys/types.h>
78
#include <regex>
9+
#include <cctype>
810
#include "util.hpp"
911

1012
struct stat info;

0 commit comments

Comments
 (0)