Skip to content

Commit

Permalink
Colon cannot be used as a path separator for FIFTPATH or -I argument …
Browse files Browse the repository at this point in the history
…in fift on Windows when absolute paths are used (e.g. C:\path\lib:C:\path\smartcont).

Suggestion to use @ as a new path separator on Windows.
  • Loading branch information
neodiX committed Jun 5, 2024
1 parent 30091a0 commit 9828938
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
9 changes: 8 additions & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,17 @@ if (NOT CMAKE_CROSSCOMPILING OR USE_EMSCRIPTEN)
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DEST_FIF}
)
set(ARG_DEST_CPP "${ARG_DEST}.cpp")

if (WIN32)
set(ARG_LIB_DIR "fift/lib@smartcont")
else()
set(ARG_LIB_DIR "fift/lib:smartcont")
endif()

add_custom_command(
COMMENT "Generate ${ARG_DEST_CPP}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND fift -Ifift/lib:smartcont -s asm-to-cpp.fif ${ARG_DEST_FIF} ${ARG_DEST_CPP} ${ARG_NAME}
COMMAND fift -I${ARG_LIB_DIR} -s asm-to-cpp.fif ${ARG_DEST_FIF} ${ARG_DEST_CPP} ${ARG_NAME}
MAIN_DEPENDENCY ${ARG_SOURCE}
DEPENDS fift ${ARG_DEST_FIF} smartcont/asm-to-cpp.fif fift/lib/Asm.fif
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DEST_CPP}
Expand Down
9 changes: 7 additions & 2 deletions crypto/block/create-state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,16 @@ void usage(const char* progname) {
void parse_include_path_set(std::string include_path_set, std::vector<std::string>& res) {
td::Parser parser(include_path_set);
while (!parser.empty()) {
auto path = parser.read_till_nofail(':');
#if TD_WINDOWS
auto path_separator = '@';
#else
auto path_separator = ':';
#endif
auto path = parser.read_till_nofail(path_separator);
if (!path.empty()) {
res.push_back(path.str());
}
parser.skip_nofail(':');
parser.skip_nofail(path_separator);
}
}

Expand Down
11 changes: 8 additions & 3 deletions crypto/fift/fift-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void usage(const char* progname) {
<< " [-i] [-n] [-I <source-include-path>] {-L <library-fif-file>} <source-file1-fif> <source-file2-fif> ...\n";
std::cerr << "\t-n\tDo not preload standard preamble file `Fift.fif`\n"
"\t-i\tForce interactive mode even if explicit source file names are indicated\n"
"\t-I<source-search-path>\tSets colon-separated library source include path. If not indicated, "
"\t-I<source-search-path>\tSets colon-separated (unix) or at-separated (windows) library source include path. If not indicated, "
"$FIFTPATH is used instead.\n"
"\t-L<library-fif-file>\tPre-loads a library source file\n"
"\t-d<ton-db-path>\tUse a ton database\n"
Expand All @@ -75,11 +75,16 @@ void usage(const char* progname) {
void parse_include_path_set(std::string include_path_set, std::vector<std::string>& res) {
td::Parser parser(include_path_set);
while (!parser.empty()) {
auto path = parser.read_till_nofail(':');
#if TD_WINDOWS
auto path_separator = '@';
#else
auto path_separator = ':';
#endif
auto path = parser.read_till_nofail(path_separator);
if (!path.empty()) {
res.push_back(path.str());
}
parser.skip_nofail(':');
parser.skip_nofail(path_separator);
}
}

Expand Down

0 comments on commit 9828938

Please sign in to comment.