Skip to content

Commit

Permalink
Merge pull request mariuz#330 from arvanus/master
Browse files Browse the repository at this point in the history
fix saving style error and code scanning alert
  • Loading branch information
arvanus authored Oct 5, 2023
2 parents c8e4bb4 + aaa5111 commit d62df7e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ const wxString FRConfig::getSysTemplateFileName(const wxString& templateName)

wxString FRConfig::getXmlStylesPath() const
{
if (wxDirExists(getUserLocalDataDir() + wxFileName::GetPathSeparator() + "xml-styles"))
return getUserLocalDataDir() + wxFileName::GetPathSeparator()
+ "xml-styles" + wxFileName::GetPathSeparator();

return getHomePath() + "xml-styles"
+ wxFileName::GetPathSeparator();
}
Expand Down
21 changes: 21 additions & 0 deletions src/gui/PreferencesDialogSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1984,6 +1984,27 @@ bool PrefDlgThemeSetting::parseProperty(wxXmlNode* xmln)
bool PrefDlgThemeSetting::saveToTargetConfig(Config& config)
{
config.setValue(keyM, fileComboBoxM->GetValue());
wxString userStyleFolder = config.getUserLocalDataDir() + wxFileName::GetPathSeparator() + "xml-styles" + wxFileName::GetPathSeparator();
if (!wxDirExists(userStyleFolder))
{
wxFileName mFile = getStyleManager()->getfileName();
mFile.SetPath(userStyleFolder);

wxString sourceDirName = config.getHomePath() + "xml-styles" + wxFileName::GetPathSeparator();

wxString fileSpec = _T("*.xml");
wxArrayString files;
if (wxDir::GetAllFiles(sourceDirName, &files, fileSpec, wxDIR_FILES) > 0) {
wxMkdir(userStyleFolder);
wxString name, ext;
for (size_t i = 0; i < files.GetCount(); i++) {
wxFileName::SplitPath(files[i], NULL, &name, &ext);
wxCopyFile(files[i], userStyleFolder + name + "." + ext);
}
}
getStyleManager()->setfileName(mFile);
}

getStyleManager()->saveStyle();

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/sql/StatementBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void StatementBuilder::addNewLine()
{
completedLinesM += currentLineM;
completedLinesM += wxTextBuffer::GetEOL();
currentLineM = wxString(wxChar(' '), indentLevelM * indentCharsM);
currentLineM = wxString(wxChar(' '), static_cast<unsigned long>(indentLevelM) * static_cast<unsigned long>(indentCharsM));
}

void StatementBuilder::reset()
Expand Down

0 comments on commit d62df7e

Please sign in to comment.