This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[uncia] update to 2.0.4 simplify code and improve cli
- Loading branch information
Showing
26 changed files
with
3,322 additions
and
1,554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,40 @@ | ||
#include <bela/base.hpp> | ||
#include <bela/str_cat.hpp> | ||
#include <filesystem> | ||
|
||
namespace uncia::archive { | ||
std::optional<std::string> JoinSanitizePath(std::wstring_view root, std::string_view filename, bool always_utf8 = true); | ||
bool MakeFlattened(std::wstring_view dir, std::wstring_view dest, bela::error_code &ec); | ||
bool MakeDir(std::wstring_view path, bela::error_code &ec); | ||
std::wstring_view PathRemoveExtension(std::wstring_view p); | ||
inline std::wstring FileDestination(std::wstring_view arfile) { | ||
if (auto d = PathRemoveExtension(arfile); d.size() != arfile.size()) { | ||
return std::wstring(d); | ||
} | ||
return bela::StringCat(arfile, L".out"); | ||
// Flattened: find flatten child directories | ||
std::optional<std::filesystem::path> Flattened(const std::filesystem::path &d); | ||
// MakeFlattened: Flatten directories | ||
bool MakeFlattened(const std::filesystem::path &d, bela::error_code &ec); | ||
|
||
inline bool MakeDirectories(const std::filesystem::path &path, bela::error_code &ec) { | ||
std::error_code e; | ||
if (std::filesystem::exists(path, e)) { | ||
return true; | ||
} | ||
if (std::filesystem::create_directories(path, e); e) { | ||
ec = bela::make_error_code_from_std(e); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
inline bool MakeParentDirectories(const std::filesystem::path &path, bela::error_code &ec) { | ||
std::error_code e; | ||
auto parent = path.parent_path(); | ||
if (std::filesystem::exists(parent, e)) { | ||
return true; | ||
} | ||
if (std::filesystem::create_directories(parent, e); e) { | ||
ec = bela::make_error_code_from_std(e); | ||
return false; | ||
} | ||
return true; | ||
} | ||
std::wstring_view PathStripExtension(std::wstring_view p); | ||
std::optional<std::filesystem::path> MakeUnqiueExtractedDestination(const std::filesystem::path &archive_file, | ||
std::filesystem::path &strict_folder); | ||
std::optional<std::filesystem::path> JoinSanitizeFsPath(const std::filesystem::path &root, std::string_view child_path, | ||
bool always_utf8, std::wstring &encoded_path); | ||
} // namespace uncia::archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8.0.1 | ||
8.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.