Skip to content

Commit

Permalink
Def Parser: make it work with long path better
Browse files Browse the repository at this point in the history
Previously, only arguments in parameter file are converted to long path.
Now, we convert every path we use to long path.

Change-Id: Iafff8b7a0f69f82cc9f8f9399b35528814eb7715
  • Loading branch information
meteorcloudy committed Sep 5, 2017
1 parent c77f891 commit 87c31aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions third_party/def_parser/def_parser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <iostream>
#include <string>

#include "src/main/cpp/util/file_platform.h"
#include "third_party/def_parser/def_parser.h"

static const char* ws = " \t\n\r\f\v";
Expand Down Expand Up @@ -37,7 +38,9 @@ int main(int argc, char* argv[]) {
return 1;
}

FILE* fout = fopen(argv[1], "w+");
std::wstring filenameW;
blaze_util::AsAbsoluteWindowsPath(argv[1], &filenameW);
FILE* fout = _wfopen(filenameW.c_str(), L"w+");
if (!fout) {
std::cerr << "Could not open output .def file: " << argv[1] << "\n";
return 1;
Expand All @@ -50,7 +53,8 @@ int main(int argc, char* argv[]) {
for (int i = 3; i < argc; i++) {
// If the argument starts with @, then treat it as a parameter file.
if (argv[i][0] == '@') {
std::ifstream paramfile(argv[i] + 1, std::ios::in | std::ios::binary);
blaze_util::AsAbsoluteWindowsPath(argv[i] + 1, &filenameW);
std::ifstream paramfile(filenameW.c_str(), std::ios::in | std::ios::binary);
if (!paramfile) {
std::cerr << "Could not open parameter file: " << argv[i] << "\n";
return 1;
Expand Down

0 comments on commit 87c31aa

Please sign in to comment.