mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 05:46:48 +08:00
chore: rename realpath to physicalPath so codefactor doesn't complain
This commit is contained in:
parent
b5e025b45f
commit
f83bc66699
@ -184,7 +184,6 @@ void TextureParser::parseContainer (Texture& header, const BinaryReader& file) {
|
|||||||
} else {
|
} else {
|
||||||
sLog.exception ("unknown texture format type: ", std::string_view (magic, 9));
|
sLog.exception ("unknown texture format type: ", std::string_view (magic, 9));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureParser::parseAnimations (Texture& header, const BinaryReader& file) {
|
void TextureParser::parseAnimations (Texture& header, const BinaryReader& file) {
|
||||||
@ -217,7 +216,6 @@ void TextureParser::parseAnimations (Texture& header, const BinaryReader& file)
|
|||||||
header.gifWidth = (*header.frames.begin ())->width1;
|
header.gifWidth = (*header.frames.begin ())->width1;
|
||||||
header.gifHeight = (*header.frames.begin ())->height1;
|
header.gifHeight = (*header.frames.begin ())->height1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TextureParser::parseTextureFlags (uint32_t value) {
|
uint32_t TextureParser::parseTextureFlags (uint32_t value) {
|
||||||
|
@ -53,7 +53,7 @@ bool DirectoryAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path DirectoryAdapter::realpath (const std::filesystem::path& path) const {
|
std::filesystem::path DirectoryAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
||||||
|
|
||||||
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
||||||
|
@ -18,7 +18,7 @@ struct DirectoryAdapter final : Adapter {
|
|||||||
|
|
||||||
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] std::filesystem::path realpath (const std::filesystem::path& path) const override;
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
||||||
|
|
||||||
const std::filesystem::path basepath;
|
const std::filesystem::path basepath;
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,7 @@ bool PackageAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path PackageAdapter::realpath (const std::filesystem::path& path) const {
|
std::filesystem::path PackageAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Assets::CAssetLoadException ("Package adapter does not support realpath", path);
|
throw Assets::CAssetLoadException ("Package adapter does not support realpath", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct PackageAdapter final : Adapter {
|
|||||||
|
|
||||||
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] std::filesystem::path realpath (const std::filesystem::path& path) const override;
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
||||||
|
|
||||||
PackageUniquePtr package;
|
PackageUniquePtr package;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ struct Adapter {
|
|||||||
|
|
||||||
[[nodiscard]] virtual ReadStreamSharedPtr open (const std::filesystem::path& path) const = 0;
|
[[nodiscard]] virtual ReadStreamSharedPtr open (const std::filesystem::path& path) const = 0;
|
||||||
[[nodiscard]] virtual bool exists (const std::filesystem::path& path) const = 0;
|
[[nodiscard]] virtual bool exists (const std::filesystem::path& path) const = 0;
|
||||||
[[nodiscard]] virtual std::filesystem::path realpath (const std::filesystem::path& path) const = 0;
|
[[nodiscard]] virtual std::filesystem::path physicalPath (const std::filesystem::path& path) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using AdapterSharedPtr = std::shared_ptr<Adapter>;
|
using AdapterSharedPtr = std::shared_ptr<Adapter>;
|
||||||
|
@ -21,7 +21,7 @@ bool VirtualAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
return this->files.contains (path);
|
return this->files.contains (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path VirtualAdapter::realpath (const std::filesystem::path& path) const {
|
std::filesystem::path VirtualAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Assets::CAssetLoadException ("Virtual adapter does not support realpath", path);
|
throw Assets::CAssetLoadException ("Virtual adapter does not support realpath", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ struct VirtualFactory final : Factory {
|
|||||||
struct VirtualAdapter final : Adapter {
|
struct VirtualAdapter final : Adapter {
|
||||||
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
[[nodiscard]] ReadStreamSharedPtr open (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
[[nodiscard]] bool exists (const std::filesystem::path& path) const override;
|
||||||
[[nodiscard]] std::filesystem::path realpath (const std::filesystem::path& path) const override;
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
||||||
|
|
||||||
void add (const std::filesystem::path& path, const char* data);
|
void add (const std::filesystem::path& path, const char* data);
|
||||||
void add (const std::filesystem::path& path, const JSON& contents);
|
void add (const std::filesystem::path& path, const JSON& contents);
|
||||||
|
@ -76,10 +76,10 @@ std::string Container::readString (const std::filesystem::path& path) const {
|
|||||||
return buffer.str ();
|
return buffer.str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path Container::realpath (const std::filesystem::path& path) const {
|
std::filesystem::path Container::physicalPath (const std::filesystem::path& path) const {
|
||||||
std::filesystem::path normalized = normalize_path (path);
|
std::filesystem::path normalized = normalize_path (path);
|
||||||
|
|
||||||
return this->resolveAdapterForFile (path).realpath (normalized);
|
return this->resolveAdapterForFile (path).physicalPath (normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Container {
|
|||||||
* @param path The path to resolve to a real file
|
* @param path The path to resolve to a real file
|
||||||
* @return The full public, absolute path to the given file
|
* @return The full public, absolute path to the given file
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] std::filesystem::path realpath (const std::filesystem::path& path) const;
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,7 @@ CVideo::CVideo (
|
|||||||
sLog.exception ("Failed to initialize MPV's GL context");
|
sLog.exception ("Failed to initialize MPV's GL context");
|
||||||
|
|
||||||
const std::filesystem::path videopath =
|
const std::filesystem::path videopath =
|
||||||
this->getVideo ().project.container->realpath (this->getVideo ().filename);
|
this->getVideo ().project.container->physicalPath (this->getVideo ().filename);
|
||||||
|
|
||||||
// build the path to the video file
|
// build the path to the video file
|
||||||
const char* command [] = {"loadfile", videopath.c_str (), nullptr};
|
const char* command [] = {"loadfile", videopath.c_str (), nullptr};
|
||||||
|
Loading…
Reference in New Issue
Block a user