Skip to content

Commit e0c0e6b

Browse files
committed
Update for primitives changes.
1 parent 9e40271 commit e0c0e6b

14 files changed

Lines changed: 149 additions & 138 deletions

File tree

src/client/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ void self_upgrade()
599599
fn = fs::temp_directory_path() / unique_path();
600600
std::cout << "Downloading the latest client" << "\n";
601601
download_file(s.remotes[0].url + client, fn, 50_MB);
602-
if (md5sum != md5(fn))
602+
if (md5sum != md5_file(fn))
603603
throw std::runtime_error("Downloaded bad file (md5 check failed)");
604604

605605
std::cout << "Unpacking" << "\n";

src/client/resource.rc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//MAINICON ICON "client.ico"
22

33
1 VERSIONINFO
4-
FILEVERSION VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, BUILD_NUMBER
5-
PRODUCTVERSION VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, BUILD_NUMBER
64
BEGIN
75
BLOCK "StringFileInfo"
86
BEGIN

src/common/database.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ void ServiceDatabase::setFileStamps(const Stamps &stamps) const
639639
}
640640
String q = "replace into FileStamps values ";
641641
for (auto &s : stamps)
642-
q += "('" + normalize_path(s.first) + "', '" + std::to_string((int64_t)s.second.time_since_epoch().count()) + "'),";
642+
q += "('" + to_printable_string(normalize_path(s.first)) + "', '" + std::to_string((int64_t)s.second.time_since_epoch().count()) + "'),";
643643
q.resize(q.size() - 1);
644644
q += ";";
645645
db->execute(q);

src/common/package_store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ PackageStore::read_packages_from_file(path p, const String &config_name, bool di
500500
throw std::runtime_error("Unknown file type " + p.string());
501501

502502
// prepare names
503-
auto pname = normalize_path(p);
503+
auto pname = to_printable_string(normalize_path(p));
504504
#ifdef _WIN32 // || macos/ios?
505505
// prevent different project names for lower/upper case folders
506506
boost::to_lower(pname);

src/common/project.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void check_file_types(const Files &files)
200200
auto fn = get_temp_filename();
201201
std::ofstream o(fn, std::ios::binary | std::ios::out);
202202
if (!o)
203-
throw std::runtime_error("Cannot open file for writing: " + fn.u8string());
203+
throw std::runtime_error("Cannot open file for writing: " + to_printable_string(fn));
204204
for (auto &file : files)
205205
o << "file -ib " << normalize_path(file) << "\n";
206206
o.close();
@@ -367,7 +367,7 @@ void Patch::save(yaml &node) const
367367
save_replace(file_patches, "replace", UNIDIFF_PREFIX);
368368
}
369369

370-
void Patch::patchSources(const Project &prj, const Files &files) const
370+
void Patch::patchSources(const Project &prj, const FilesSorted &files) const
371371
{
372372
auto rd = prj.pkg.getDirSrc();
373373
for (auto &[s, f] : file_patches)
@@ -492,7 +492,7 @@ void Project::findSources(path p)
492492

493493
auto create_regex = [&p](const auto &e)
494494
{
495-
auto s = normalize_path(p);
495+
auto s = to_printable_string(normalize_path(p));
496496
s = escape_regex_symbols(s);
497497
if (!s.empty() && s.back() != '/')
498498
s += "/";
@@ -510,7 +510,7 @@ void Project::findSources(path p)
510510
if (!fs::is_regular_file(f))
511511
continue;
512512

513-
auto s = normalize_path(f);
513+
auto s = to_printable_string(normalize_path(f));
514514
for (auto &e : rgxs)
515515
{
516516
if (!std::regex_match(s, e.second))
@@ -528,7 +528,7 @@ void Project::findSources(path p)
528528
auto to_remove = files;
529529
for (auto &f : files)
530530
{
531-
auto s = normalize_path(f);
531+
auto s = to_printable_string(normalize_path(f));
532532
for (auto &e : rgxs_exclude)
533533
{
534534
if (!std::regex_match(s, e.second))
@@ -1292,8 +1292,8 @@ yaml Project::save() const
12921292
ADD_IF_EQU_VAL(library_type, LibraryType::Module, "module");
12931293
ADD_IF_EQU_VAL(executable_type, ExecutableType::Win32, "win32");
12941294

1295-
ADD_IF_NOT_EMPTY_VAL(root_directory, normalize_path(root_directory));
1296-
ADD_IF_NOT_EMPTY_VAL(unpack_directory, normalize_path(unpack_directory));
1295+
ADD_IF_NOT_EMPTY_VAL(root_directory, to_printable_string(normalize_path(root_directory)));
1296+
ADD_IF_NOT_EMPTY_VAL(unpack_directory, to_printable_string(normalize_path(unpack_directory)));
12971297
ADD_IF_NOT_EMPTY(output_directory);
12981298

12991299
ADD_IF_NOT_EMPTY(output_name);
@@ -1340,11 +1340,11 @@ yaml Project::save() const
13401340
ADD_SET(include_hints, include_hints);
13411341

13421342
for (auto &v : include_directories.public_)
1343-
root["include_directories"]["public"].push_back(normalize_path(v));
1343+
root["include_directories"]["public"].push_back(to_printable_string(normalize_path(v)));
13441344
for (auto &v : include_directories.private_)
1345-
root["include_directories"]["private"].push_back(normalize_path(v));
1345+
root["include_directories"]["private"].push_back(to_printable_string(normalize_path(v)));
13461346
for (auto &v : include_directories.interface_)
1347-
root["include_directories"]["interface"].push_back(normalize_path(v));
1347+
root["include_directories"]["interface"].push_back(to_printable_string(normalize_path(v)));
13481348
saveOptionsMap(root, options);
13491349
ADD_SET(aliases, aliases);
13501350
ADD_SET(checks_prefixes, checks_prefixes);
@@ -1392,7 +1392,7 @@ void Project::patchSources() const
13921392
patch.patchSources(*this, getSources());
13931393
}
13941394

1395-
const Files &Project::getSources() const
1395+
const FilesSorted &Project::getSources() const
13961396
{
13971397
if (!files.empty())
13981398
return files;

src/common/project.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct Patch
185185

186186
void load(const yaml &root);
187187
void save(yaml &root) const;
188-
void patchSources(const Project &p, const Files &files) const;
188+
void patchSources(const Project &p, const FilesSorted &files) const;
189189
};
190190

191191
struct Project
@@ -255,7 +255,7 @@ struct Project
255255

256256
// files to include into archive
257257
// also is used for enumerating sources (mutable for this)
258-
mutable Files files;
258+
mutable FilesSorted files;
259259

260260
// root_directory where all files are stored
261261
path root_directory;
@@ -324,7 +324,7 @@ struct Project
324324
private:
325325
ProjectPath root_project;
326326

327-
const Files &getSources() const;
327+
const FilesSorted &getSources() const;
328328
ProjectPath relative_name_to_absolute(const String &name);
329329
};
330330

src/common/resolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void Resolver::download_and_unpack()
259259
write_file(hash_file, d.hash);
260260

261261
LOG_INFO(logger, "Unpacking : " << d.target_name << "...");
262-
Files files;
262+
FilesSorted files;
263263
try
264264
{
265265
files = unpack_file(fn, version_dir);

src/common/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ void Settings::save(const path &p) const
584584
{
585585
std::ofstream o(p);
586586
if (!o)
587-
throw std::runtime_error("Cannot open file: " + p.u8string());
587+
throw std::runtime_error("Cannot open file: " + to_printable_string(p));
588588
yaml root;
589589
root["remotes"][DEFAULT_REMOTE_NAME]["url"] = remotes[0].url;
590590
root["storage_dir"] = storage_dir.string();

src/common/spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Specification download_specification(const Package &pkg)
2929
{
3030
auto url = path(SPEC_FILES_LOCATION) / pkg.ppath.toFileSystemPath() / (pkg.version.toString() + SPEC_FILE_EXTENSION);
31-
auto spec = download_file(normalize_path(url));
31+
auto spec = download_file(to_printable_string(normalize_path(url)));
3232
return read_specification(spec);
3333
}
3434

src/common/sqlite_database.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ sqlite3 *load_from_file(const path &fn, bool read_only)
108108
else
109109
flags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
110110
sqlite3_enable_shared_cache(1);
111-
ok = sqlite3_open_v2(fn.u8string().c_str(), &db, flags, nullptr) == SQLITE_OK;
111+
ok = sqlite3_open_v2((const char *)fn.u8string().c_str(), &db, flags, nullptr) == SQLITE_OK;
112112
if (!ok)
113113
{
114114
String error = "Can't open database file: " + fn.string() + " error: " + sqlite3_errmsg(db);

0 commit comments

Comments
 (0)