Skip to content

Commit

Permalink
Fix Sentry (crash logging) for Win64.
Browse files Browse the repository at this point in the history
The issue was windows defaults to wide-strings. Sadly sentry doesn't seem to take wide-string paths, so that users with non-ASCII names might be left out again :-/

part of CURA-11364
  • Loading branch information
rburema committed Nov 22, 2023
1 parent 5ef89b5 commit d020d0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/utils/format/filesystem_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct formatter<std::filesystem::path> : formatter<string_view>
template<typename FormatContext>
auto format(const std::filesystem::path& path, FormatContext& ctx)
{
return formatter<string_view>::format(anonymizePath(path.native()), ctx);
return formatter<string_view>::format(anonymizePath(path.generic_string()), ctx);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <string>

#include <range/v3/algorithm/contains.hpp>
#include <range/v3/to_container.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/take_while.hpp>

#include "utils/format/filesystem_path.h"
Expand Down Expand Up @@ -78,7 +78,7 @@ int main(int argc, char** argv)
const auto config_path = std::filesystem::path(fmt::format("{}\\cura\\.sentry-native", std::getenv("APPDATA")));
#endif
spdlog::info("Sentry config path: {}", config_path);
sentry_options_set_database_path(options, static_cast<const char*>(std::filesystem::absolute(config_path).native().c_str()));
sentry_options_set_database_path(options, std::filesystem::absolute(config_path).generic_string().c_str());
constexpr std::string_view cura_engine_version{ CURA_ENGINE_VERSION };
const auto version = semver::from_string(
cura_engine_version
Expand Down

0 comments on commit d020d0f

Please sign in to comment.