Fix mod installation in non latin folders. Use OSString for consistency.
Refse7ab22286e
Refs880a797ce0
Refs404e1a9a4a
Refs52baaa4bbd
This was SVN commit r27055.
This commit is contained in:
parent
880a797ce0
commit
c9dc8676a6
@ -33,6 +33,11 @@
|
||||
#include "scriptinterface/ScriptExceptions.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
||||
#if !OS_WIN
|
||||
#include "lib/os_path.h"
|
||||
#include "lib/path.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
@ -55,7 +60,7 @@ bool LoadModJSON(const PIVFS& vfs, OsPath modsPath, OsPath mod, std::string& tex
|
||||
#if OS_WIN
|
||||
const std::filesystem::path modJsonPath = (modsPath / mod / L"mod.json").fileSystemPath();
|
||||
#else
|
||||
const std::string modJsonPath = (modsPath / mod / L"mod.json").string8();
|
||||
const Path::String modJsonPath = OsString(modsPath / mod / L"mod.json").c_str();
|
||||
#endif
|
||||
// Attempt to open mod.json first.
|
||||
std::ifstream modjson(modJsonPath);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -21,13 +21,22 @@
|
||||
|
||||
#include "lib/file/vfs/vfs_util.h"
|
||||
#include "lib/file/file_system.h"
|
||||
#include "lib/sysdep/os.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
|
||||
#if !OS_WIN
|
||||
#include "lib/os_path.h"
|
||||
#include "lib/path.h"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#if OS_WIN
|
||||
#include <filesystem>
|
||||
#endif
|
||||
|
||||
CModInstaller::CModInstaller(const OsPath& modsdir, const OsPath& tempdir) :
|
||||
m_ModsDir(modsdir), m_TempDir(tempdir / "_modscache"), m_CacheDir("cache/")
|
||||
@ -107,7 +116,12 @@ CModInstaller::ModInstallationResult CModInstaller::Install(
|
||||
|
||||
DeleteDirectory(modTemp.Parent());
|
||||
|
||||
std::ofstream mod_json((modDir / "mod.json").string8());
|
||||
#if OS_WIN
|
||||
const std::filesystem::path modJsonPath = (modDir / L"mod.json").fileSystemPath();
|
||||
#else
|
||||
const Path::String modJsonPath = OsString(modDir / L"mod.json").c_str();
|
||||
#endif
|
||||
std::ofstream mod_json(modJsonPath);
|
||||
if (mod_json.good())
|
||||
{
|
||||
mod_json << modinfo.GetAsString();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -21,6 +21,7 @@
|
||||
#include "CStr.h"
|
||||
#include "lib/file/vfs/vfs.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class ScriptContext;
|
||||
|
Loading…
Reference in New Issue
Block a user