Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2021-12-21 17:53:52 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-12-21 17:54:09 +0300
commit8cf19944557452ae7a9c1cb2365d6121f2dfdb4d (patch)
tree5e72acf407ba4734c8a0b3f72f6b38f8b04839b4 /source/blender/blenkernel/intern/asset_catalog.cc
parentd66a6525c361d93de2f7878bad27cd78dff2ecfd (diff)
Fix T93960: Asset Catalogs I/O fails with unicode file paths on Windows
On Windows, encode file paths as UTF-16 before trying to open the file for reading/writing. This introduces a new class `blender::fstream`, which wraps `std::fstream` and provides this UTF-16 encoding. This class should also be used in other areas, like the Alembic importer/exporter. Manifest Task: T93960 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13633
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog.cc')
-rw-r--r--source/blender/blenkernel/intern/asset_catalog.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index 79504edb50d..eee1f6287c3 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -24,7 +24,7 @@
#include "BKE_asset_catalog.hh"
#include "BKE_asset_library.h"
-#include "BLI_fileops.h"
+#include "BLI_fileops.hh"
#include "BLI_path_util.h"
/* For S_ISREG() and S_ISDIR() on Windows. */
@@ -830,7 +830,7 @@ void AssetCatalogDefinitionFile::parse_catalog_file(
const CatalogFilePath &catalog_definition_file_path,
AssetCatalogParsedFn catalog_loaded_callback)
{
- std::fstream infile(catalog_definition_file_path);
+ fstream infile(catalog_definition_file_path, std::ios::in);
if (!infile.is_open()) {
CLOG_ERROR(&LOG, "%s: unable to open file", catalog_definition_file_path.c_str());
@@ -966,7 +966,7 @@ bool AssetCatalogDefinitionFile::write_to_disk_unsafe(const CatalogFilePath &des
return false;
}
- std::ofstream output(dest_file_path);
+ fstream output(dest_file_path, std::ios::out);
/* TODO(@sybren): remember the line ending style that was originally read, then use that to write
* the file again. */