add download_image, refactor import_image

This commit is contained in:
GenevensiS
2025-12-28 13:59:23 +01:00
parent 3d0f21d483
commit 5c1b7b9dfc
13 changed files with 157 additions and 86 deletions
+3 -3
View File
@@ -189,7 +189,7 @@ public:
// ----------------------------------------------------------------------------- : Package : inside
bool Package::existsIn(const String& file) {
bool Package::contains(const String& file) {
FileInfos::iterator it = files.find(normalize_internal_filename(file));
if (it == files.end()) {
// does it look like a relative filename?
@@ -650,11 +650,11 @@ void Packaged::loadFully() {
}
}
void Packaged::save() {
void Packaged::save(bool remove_unused) {
WITH_DYNAMIC_ARG(writing_package, this);
writeFile(typeName(), *this, fileVersion());
referenceFile(typeName());
Package::save();
Package::save(remove_unused);
}
void Packaged::saveAs(const String& package, bool remove_unused, bool as_directory) {
WITH_DYNAMIC_ARG(writing_package, this);
+5 -5
View File
@@ -178,15 +178,15 @@ public:
// --------------------------------------------------- : Managing the inside of the package
/// Check if a file is in the package.
bool existsIn(const String& file);
inline bool existsIn(const LocalFileName& file) {
return existsIn(file.fn);
bool contains(const String& file);
inline bool contains(const LocalFileName& file) {
return contains(file.fn);
}
/// Open an input stream for a file in the package.
unique_ptr<wxInputStream> openIn(const String& file);
inline unique_ptr<wxInputStream> openIn(const LocalFileName& file) {
return openIn(file.fn);
return openIn(file.fn);
}
/// Open an output stream for a file in the package.
@@ -331,7 +331,7 @@ public:
void open(const String& package, bool just_header = false);
/// Ensure the package is fully loaded.
void loadFully();
void save();
void save(bool remove_unused = true);
void saveAs(const String& package, bool remove_unused = true, bool as_directory = false);
void saveCopy(const String& package);
+1 -1
View File
@@ -103,7 +103,7 @@ bool PackageManager::existsInPackage(const String& name) {
if (start < pos && pos != String::npos) {
// open package
PackagedP p = openAny(name.substr(start, pos - start));
return p->existsIn(name.substr(pos + 1));
return p->contains(name.substr(pos + 1));
}
}
throw FileNotFoundError(name, _("No package name specified, use '/package/filename'"));