mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 12:39:57 +00:00
Fix extensions wrongly being detected as "built-in" (#4625)
This commit is contained in:
parent
5798e27993
commit
d62d279a34
@ -391,9 +391,8 @@ void AppMenus::reload()
|
|||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
// Load scripts
|
// Load scripts
|
||||||
ResourceFinder rf;
|
ResourceFinder rf;
|
||||||
rf.includeUserDir("scripts/.");
|
rf.includeUserDir("scripts");
|
||||||
std::string scriptsDir = rf.getFirstOrCreateDefault();
|
std::string scriptsDir = rf.getFirstOrCreateDefault();
|
||||||
scriptsDir = base::get_file_path(scriptsDir);
|
|
||||||
if (base::is_directory(scriptsDir)) {
|
if (base::is_directory(scriptsDir)) {
|
||||||
loadScriptsSubmenu(scriptsMenu->getSubmenu(), scriptsDir, true);
|
loadScriptsSubmenu(scriptsMenu->getSubmenu(), scriptsDir, true);
|
||||||
}
|
}
|
||||||
|
@ -794,7 +794,7 @@ Extensions::Extensions()
|
|||||||
// Create and get the user extensions directory
|
// Create and get the user extensions directory
|
||||||
{
|
{
|
||||||
ResourceFinder rf2;
|
ResourceFinder rf2;
|
||||||
rf2.includeUserDir("extensions/.");
|
rf2.includeUserDir("extensions");
|
||||||
m_userExtensionsPath = rf2.getFirstOrCreateDefault();
|
m_userExtensionsPath = rf2.getFirstOrCreateDefault();
|
||||||
m_userExtensionsPath = base::normalize_path(m_userExtensionsPath);
|
m_userExtensionsPath = base::normalize_path(m_userExtensionsPath);
|
||||||
if (!m_userExtensionsPath.empty() &&
|
if (!m_userExtensionsPath.empty() &&
|
||||||
@ -811,33 +811,34 @@ Extensions::Extensions()
|
|||||||
// Load extensions from data/ directory on all possible locations
|
// Load extensions from data/ directory on all possible locations
|
||||||
// (installed folder and user folder)
|
// (installed folder and user folder)
|
||||||
while (rf.next()) {
|
while (rf.next()) {
|
||||||
auto extensionsDir = rf.filename();
|
const auto& extensionsDir = rf.filename();
|
||||||
|
|
||||||
if (base::is_directory(extensionsDir)) {
|
if (!base::is_directory(extensionsDir))
|
||||||
for (auto fn : base::list_files(extensionsDir)) {
|
continue;
|
||||||
const auto dir = base::join_path(extensionsDir, fn);
|
|
||||||
if (!base::is_directory(dir))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const bool isBuiltinExtension =
|
for (auto& fn : base::list_files(extensionsDir)) {
|
||||||
(m_userExtensionsPath != base::get_file_path(dir));
|
const auto dir = base::join_path(extensionsDir, fn);
|
||||||
|
if (!base::is_directory(dir))
|
||||||
|
continue;
|
||||||
|
|
||||||
auto fullFn = base::join_path(dir, kPackageJson);
|
const bool isBuiltinExtension =
|
||||||
fullFn = base::normalize_path(fullFn);
|
(m_userExtensionsPath != base::get_file_path(dir));
|
||||||
|
|
||||||
LOG("EXT: Loading extension '%s'...\n", fullFn.c_str());
|
auto fullFn = base::join_path(dir, kPackageJson);
|
||||||
if (!base::is_file(fullFn)) {
|
fullFn = base::normalize_path(fullFn);
|
||||||
LOG("EXT: File '%s' not found\n", fullFn.c_str());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
LOG("EXT: Loading extension '%s'...\n", fullFn.c_str());
|
||||||
loadExtension(dir, fullFn, isBuiltinExtension);
|
if (!base::is_file(fullFn)) {
|
||||||
}
|
LOG("EXT: File '%s' not found\n", fullFn.c_str());
|
||||||
catch (const std::exception& ex) {
|
continue;
|
||||||
LOG("EXT: Error loading JSON file: %s\n",
|
}
|
||||||
ex.what());
|
|
||||||
}
|
try {
|
||||||
|
loadExtension(dir, fullFn, isBuiltinExtension);
|
||||||
|
}
|
||||||
|
catch (const std::exception& ex) {
|
||||||
|
LOG("EXT: Error loading JSON file: %s\n",
|
||||||
|
ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user