mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +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
|
||||
// Load scripts
|
||||
ResourceFinder rf;
|
||||
rf.includeUserDir("scripts/.");
|
||||
rf.includeUserDir("scripts");
|
||||
std::string scriptsDir = rf.getFirstOrCreateDefault();
|
||||
scriptsDir = base::get_file_path(scriptsDir);
|
||||
if (base::is_directory(scriptsDir)) {
|
||||
loadScriptsSubmenu(scriptsMenu->getSubmenu(), scriptsDir, true);
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ Extensions::Extensions()
|
||||
// Create and get the user extensions directory
|
||||
{
|
||||
ResourceFinder rf2;
|
||||
rf2.includeUserDir("extensions/.");
|
||||
rf2.includeUserDir("extensions");
|
||||
m_userExtensionsPath = rf2.getFirstOrCreateDefault();
|
||||
m_userExtensionsPath = base::normalize_path(m_userExtensionsPath);
|
||||
if (!m_userExtensionsPath.empty() &&
|
||||
@ -811,33 +811,34 @@ Extensions::Extensions()
|
||||
// Load extensions from data/ directory on all possible locations
|
||||
// (installed folder and user folder)
|
||||
while (rf.next()) {
|
||||
auto extensionsDir = rf.filename();
|
||||
const auto& extensionsDir = rf.filename();
|
||||
|
||||
if (base::is_directory(extensionsDir)) {
|
||||
for (auto fn : base::list_files(extensionsDir)) {
|
||||
const auto dir = base::join_path(extensionsDir, fn);
|
||||
if (!base::is_directory(dir))
|
||||
continue;
|
||||
if (!base::is_directory(extensionsDir))
|
||||
continue;
|
||||
|
||||
const bool isBuiltinExtension =
|
||||
(m_userExtensionsPath != base::get_file_path(dir));
|
||||
for (auto& fn : base::list_files(extensionsDir)) {
|
||||
const auto dir = base::join_path(extensionsDir, fn);
|
||||
if (!base::is_directory(dir))
|
||||
continue;
|
||||
|
||||
auto fullFn = base::join_path(dir, kPackageJson);
|
||||
fullFn = base::normalize_path(fullFn);
|
||||
const bool isBuiltinExtension =
|
||||
(m_userExtensionsPath != base::get_file_path(dir));
|
||||
|
||||
LOG("EXT: Loading extension '%s'...\n", fullFn.c_str());
|
||||
if (!base::is_file(fullFn)) {
|
||||
LOG("EXT: File '%s' not found\n", fullFn.c_str());
|
||||
continue;
|
||||
}
|
||||
auto fullFn = base::join_path(dir, kPackageJson);
|
||||
fullFn = base::normalize_path(fullFn);
|
||||
|
||||
try {
|
||||
loadExtension(dir, fullFn, isBuiltinExtension);
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
LOG("EXT: Error loading JSON file: %s\n",
|
||||
ex.what());
|
||||
}
|
||||
LOG("EXT: Loading extension '%s'...\n", fullFn.c_str());
|
||||
if (!base::is_file(fullFn)) {
|
||||
LOG("EXT: File '%s' not found\n", fullFn.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
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