Fixed unicode paths

This commit is contained in:
acidicoala
2025-08-24 19:29:54 +05:00
parent e08cf014d1
commit 83d6df449c
11 changed files with 80 additions and 61 deletions

View File

@@ -17,11 +17,7 @@ target_include_directories(BS_thread_pool INTERFACE ${BS_thread_pool_SOURCE_DIR}
### Steamworks Downloader executable
add_executable(steamworks_downloader steamworks_downloader.cpp)
target_link_libraries(steamworks_downloader PRIVATE
KoalaBox
cpr # HTTP client
miniz # ZIP library TODO: Use koalabox instead
)
target_link_libraries(steamworks_downloader PRIVATE KoalaBox)
### Steamworks Parser executable

View File

@@ -6,6 +6,7 @@
#include <koalabox/http_client.hpp>
#include <koalabox/logger.hpp>
#include <koalabox/path.hpp>
#include <koalabox/str.hpp>
#include <koalabox/zip.hpp>
@@ -91,10 +92,12 @@ int wmain(const int argc, const wchar_t** argv) { // NOLINT(*-use-internal-linka
const auto steamworks_dir = std::filesystem::current_path() / "steamworks";
// Special case. If there is a directory with a bunch of SDKs downloaded,
// then we can just provide it as a single argument
if(argc == 2) {
if(const auto cdn_dir = kb::str::to_str(argv[1]); fs::is_directory(cdn_dir)) {
for(const auto& entry : fs::directory_iterator(cdn_dir)) {
const auto filename = entry.path().filename().string();
const auto filename = kb::path::to_str(entry.path().filename());
const std::regex re(R"(steamworks_sdk_(.+)\.zip)");
if(std::smatch match; std::regex_match(filename, match, re)) {

View File

@@ -12,8 +12,8 @@
#include <koalabox/io.hpp>
#include <koalabox/logger.hpp>
#include <koalabox/parser.hpp>
#include <koalabox/path.hpp>
#include <koalabox/str.hpp>
#include <koalabox/util.hpp>
namespace {
namespace fs = std::filesystem;
@@ -123,8 +123,7 @@ namespace {
static std::mutex section;
if(not
interface_version.empty()
)
{
) {
const std::lock_guard lock(section);
lookup[interface_version] = current_lookup;
}
@@ -150,13 +149,14 @@ namespace {
BS::thread_pool<>& pool
) {
const auto headers_dir = sdk_path / "headers\\steam";
const auto headers_dir_str = kb::path::to_str(headers_dir);
if(not fs::exists(headers_dir)) {
LOG_WARN("Warning: SDK missing 'headers' directory: {}", headers_dir.string());
LOG_WARN("Warning: SDK missing 'headers/steam' directory: {}", headers_dir_str);
return;
}
LOG_INFO("Parsing SDK: {}", headers_dir.string());
LOG_INFO("Parsing SDK: {}", headers_dir_str);
// Go over each file in headers directory
for(const auto& entry : fs::directory_iterator(headers_dir)) {
@@ -164,7 +164,7 @@ namespace {
const auto task = pool.submit_task(
[&, header_path] {
try {
LOG_DEBUG("Parsing header: {}", header_path.string());
LOG_DEBUG("Parsing header: {}", kb::path::to_str(header_path));
const auto processed_header = manually_preprocess_header(header_path);
parse_header(processed_header, lookup);
@@ -193,21 +193,14 @@ namespace {
// Go over each steamworks sdk version
for(const auto& entry : fs::directory_iterator(steamworks_dir)) {
if(not
entry.is_directory()
)
{
if(not entry.is_directory()) {
continue;
}
if(not
sdk_filter.empty()
and
not sdk_filter
.
contains(entry.path().filename().string())
)
{
if(
not sdk_filter.empty() and
not sdk_filter.contains(kb::path::to_str(entry.path().filename()))
) {
continue;
}
@@ -222,7 +215,10 @@ namespace {
std::ofstream lookup_output(interface_lookup_path);
lookup_output << std::setw(4) << lookup;
LOG_INFO("Interface lookup generated at: {}", fs::absolute(interface_lookup_path).string());
LOG_INFO(
"Interface lookup generated at: {}",
kb::path::to_str(fs::absolute(interface_lookup_path))
);
}
}
@@ -259,4 +255,4 @@ int wmain(const int argc, const wchar_t* argv[]) { // NOLINT(*-use-internal-link
LOG_CRITICAL("Error: {}", e.what());
return 1;
}
}
}