From 9a9422bea6af5922d4025aa34f8af848d7ca336c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 17 May 2019 16:52:15 +0200 Subject: [PATCH 1/2] Use ASCII temp name for DAE on nix as well --- src/ifcconvert/IfcConvert.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index db984857eb..df2c08f82e 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -569,7 +569,10 @@ int main(int argc, char** argv) { #ifdef _MSC_VER if (output_extension == DAE || output_extension == STP || output_extension == IGS) { - // These serializers do not support opening unicode paths on Windows. Therefore +#else + if (output_extension == DAE) { +#endif + // These serializers do not support opening unicode paths. Therefore // a random temp file is generated using only ASCII characters instead. std::random_device rng; std::uniform_int_distribution index_dist(L'A', L'Z'); @@ -579,7 +582,6 @@ int main(int argc, char** argv) { } output_temp_filename += L".tmp"; } -#endif SerializerSettings settings; /// @todo Make APPLY_DEFAULT_MATERIALS configurable? Quickly tested setting this to false and using obj exporter caused the program to crash and burn. From fd9ba0d2431d0a153abb75133454e6b2b633b11a Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 18 May 2019 11:01:17 +0200 Subject: [PATCH 2/2] char wchar_t compatibility --- src/ifcconvert/IfcConvert.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index df2c08f82e..e9a8780469 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -575,12 +575,18 @@ int main(int argc, char** argv) { // These serializers do not support opening unicode paths. Therefore // a random temp file is generated using only ASCII characters instead. std::random_device rng; - std::uniform_int_distribution index_dist(L'A', L'Z'); - output_temp_filename = L".ifcopenshell."; - for (int i = 0; i < 8; ++i) { - output_temp_filename.push_back(static_cast(index_dist(rng))); + std::uniform_int_distribution index_dist('A', 'Z'); + { + std::string v = ".ifcopenshell."; + output_temp_filename += path_t(v.begin(), v.end()); + } + for (int i = 0; i < 8; ++i) { + output_temp_filename.push_back(static_cast(index_dist(rng))); + } + { + std::string v = ".tmp."; + output_temp_filename += path_t(v.begin(), v.end()); } - output_temp_filename += L".tmp"; } SerializerSettings settings;