add extension when exporting brushes

This commit is contained in:
2019-09-23 09:37:36 +02:00
parent d99d42ae34
commit d76f9b5847
2 changed files with 11 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#elif __ANDROID__
#define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "PanoPainterCPP", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); }
#define LOGW
#elif _WIN32
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
#define LOGW(M,...) { wprintf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }

View File

@@ -684,11 +684,14 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr<Brush> brush)
m_notification->SetVisibility(m_container->m_children.size() == 0);
}
bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo& info_data)
bool NodePanelBrushPreset::export_ppbr(const std::string& path_in, const PPBRInfo& info_data)
{
std::string path = path_in;
if (path_in.find(".ppbr") == std::string::npos)
path += ".ppbr";
LOG("export ppbr to: %s", path.c_str());
std::regex r(R"((.*)[\\/]([^\\/]+)(\.\w+)?$)");
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)?$)");
std::smatch m;
if (!std::regex_search(path, m, r))
return false;
@@ -937,13 +940,17 @@ bool NodePanelBrushPreset::import_ppbr(const std::string& path)
return false;
}
bool NodePanelBrushPreset::import_abr(const std::string& path)
bool NodePanelBrushPreset::import_abr(const std::string& path_in)
{
BT_SetTerminate();
ABR abr;
LOG("ABR detected");
std::string path = path_in;
if (path_in.find(".abr") == std::string::npos)
path += ".abr";
std::string name, base, ext;
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)");
std::smatch m;