From 25e7342fbc71b4cd2f31432cac614150d2ceb076 Mon Sep 17 00:00:00 2001 From: ghazan Date: Tue, 15 Mar 2022 14:42:24 +0300 Subject: file iterators, first version --- src/mir_app/mir_app.mk | 133 ++++++++++------------- src/mir_app/mir_app.project | 5 +- src/mir_app/src/database.cpp | 242 +++++++++++++++++++++--------------------- src/mir_app/src/db_events.cpp | 2 +- src/mir_app/src/db_ini.cpp | 2 +- 5 files changed, 177 insertions(+), 207 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/mir_app.mk b/src/mir_app/mir_app.mk index b2dce618a4..3a0088b7a6 100644 --- a/src/mir_app/mir_app.mk +++ b/src/mir_app/mir_app.mk @@ -6,15 +6,15 @@ ProjectName :=mir_app ConfigurationName :=Debug WorkspaceConfiguration := $(ConfigurationName) -WorkspacePath :=/home/ghazan/miranda-ng/codelite +WorkspacePath :=/var/www/miranda-ng/codelite ProjectPath :=/var/www/miranda-ng/src/mir_app -IntermediateDirectory :=../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app -OutDir :=../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app +IntermediateDirectory :=../../codelite/build-$(ConfigurationName)/__/src/mir_app +OutDir :=../../codelite/build-$(ConfigurationName)/__/src/mir_app CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=George Hazan -Date :=27/02/22 +Date :=15/03/22 CodeLitePath :=/home/ghazan/.codelite LinkerName :=g++ SharedObjectLinkerName :=g++ -shared -fPIC @@ -28,7 +28,7 @@ OutputSwitch :=-o LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c -OutputFile :=../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/lib/$(ProjectName) +OutputFile :=../../codelite/build-$(ConfigurationName)/lib/$(ProjectName) Preprocessors := ObjectSwitch :=-o ArchiveOutputSwitch := @@ -60,8 +60,7 @@ AS := as ## User defined environment variables ## CodeLiteDir:=/usr/share/codelite -Objects0=../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(ObjectSuffix) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(ObjectSuffix) \ - +Objects0=../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(ObjectSuffix) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix) @@ -73,19 +72,19 @@ Objects=$(Objects0) .PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs all: MakeIntermediateDirs $(OutputFile) -$(OutputFile): ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/.d $(Objects) - @mkdir -p "../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app" +$(OutputFile): ../../codelite/build-$(ConfigurationName)/__/src/mir_app/.d $(Objects) + @mkdir -p "../../codelite/build-$(ConfigurationName)/__/src/mir_app" @echo "" > $(IntermediateDirectory)/.d @echo $(Objects0) > $(ObjectsFileList) $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) @echo rebuilt > $(IntermediateDirectory)/mir_app.relink MakeIntermediateDirs: - @mkdir -p "../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app" - @mkdir -p ""../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/lib"" + @mkdir -p "../../codelite/build-$(ConfigurationName)/__/src/mir_app" + @mkdir -p ""../../codelite/build-$(ConfigurationName)/lib"" -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/.d: - @mkdir -p "../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app" +../../codelite/build-$(ConfigurationName)/__/src/mir_app/.d: + @mkdir -p "../../codelite/build-$(ConfigurationName)/__/src/mir_app" PreBuild: @@ -93,88 +92,64 @@ PreBuild: ## ## Objects ## -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix): src/CMPluginBase.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/CMPluginBase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_CMPluginBase.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(DependSuffix): src/CMPluginBase.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(DependSuffix) -MM src/CMPluginBase.cpp - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(PreprocessSuffix): src/CMPluginBase.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_CMPluginBase.cpp$(PreprocessSuffix) src/CMPluginBase.cpp - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(ObjectSuffix): src/database.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/database.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(DependSuffix): src/database.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(DependSuffix) -MM src/database.cpp - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(PreprocessSuffix): src/database.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_database.cpp$(PreprocessSuffix) src/database.cpp - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(ObjectSuffix): src/stdafx.cxx ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/stdafx.cxx" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_stdafx.cxx$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(DependSuffix): src/stdafx.cxx - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(DependSuffix) -MM src/stdafx.cxx - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(PreprocessSuffix): src/stdafx.cxx - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_stdafx.cxx$(PreprocessSuffix) src/stdafx.cxx - -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(ObjectSuffix): src/contact.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/contact.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(DependSuffix): src/contact.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(DependSuffix) -MM src/contact.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(ObjectSuffix): src/db_intf.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/db_intf.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(DependSuffix): src/db_intf.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(DependSuffix) -MM src/db_intf.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(PreprocessSuffix): src/contact.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contact.cpp$(PreprocessSuffix) src/contact.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(PreprocessSuffix): src/db_intf.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_intf.cpp$(PreprocessSuffix) src/db_intf.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(ObjectSuffix): src/db_events.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(DependSuffix) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(ObjectSuffix): src/db_events.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/db_events.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_events.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(DependSuffix): src/db_events.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(DependSuffix) -MM src/db_events.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(DependSuffix): src/db_events.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(DependSuffix) -MM src/db_events.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(PreprocessSuffix): src/db_events.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_events.cpp$(PreprocessSuffix) src/db_events.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(PreprocessSuffix): src/db_events.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_db_events.cpp$(PreprocessSuffix) src/db_events.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(ObjectSuffix): src/db_ini.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/db_ini.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_ini.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(DependSuffix): src/db_ini.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(DependSuffix) -MM src/db_ini.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(ObjectSuffix): src/addcontact.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/addcontact.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_addcontact.cpp$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(DependSuffix): src/addcontact.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(DependSuffix) -MM src/addcontact.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(PreprocessSuffix): src/db_ini.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_ini.cpp$(PreprocessSuffix) src/db_ini.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(PreprocessSuffix): src/addcontact.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_addcontact.cpp$(PreprocessSuffix) src/addcontact.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(ObjectSuffix): src/db_intf.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/db_intf.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(DependSuffix): src/db_intf.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(DependSuffix) -MM src/db_intf.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(ObjectSuffix): src/contact.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/contact.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(DependSuffix): src/contact.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(DependSuffix) -MM src/contact.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(PreprocessSuffix): src/db_intf.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_intf.cpp$(PreprocessSuffix) src/db_intf.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(PreprocessSuffix): src/contact.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_contact.cpp$(PreprocessSuffix) src/contact.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(ObjectSuffix): src/addcontact.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/addcontact.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_addcontact.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(DependSuffix): src/addcontact.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(DependSuffix) -MM src/addcontact.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(ObjectSuffix): src/stdafx.cxx ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/stdafx.cxx" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_stdafx.cxx$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(DependSuffix): src/stdafx.cxx + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(DependSuffix) -MM src/stdafx.cxx -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(PreprocessSuffix): src/addcontact.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_addcontact.cpp$(PreprocessSuffix) src/addcontact.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(PreprocessSuffix): src/stdafx.cxx + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_stdafx.cxx$(PreprocessSuffix) src/stdafx.cxx -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(ObjectSuffix): src/db_util.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/db_util.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_util.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(DependSuffix): src/db_util.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(DependSuffix) -MM src/db_util.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(ObjectSuffix): src/database.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/database.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(DependSuffix): src/database.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(DependSuffix) -MM src/database.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(PreprocessSuffix): src/db_util.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_db_util.cpp$(PreprocessSuffix) src/db_util.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(PreprocessSuffix): src/database.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_database.cpp$(PreprocessSuffix) src/database.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(ObjectSuffix): src/contacts.cpp ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/contacts.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_contacts.cpp$(ObjectSuffix) $(IncludePath) -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(DependSuffix): src/contacts.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(ObjectSuffix) -MF../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(DependSuffix) -MM src/contacts.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix): src/CMPluginBase.cpp ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/var/www/miranda-ng/src/mir_app/src/CMPluginBase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_CMPluginBase.cpp$(ObjectSuffix) $(IncludePath) +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(DependSuffix): src/CMPluginBase.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(ObjectSuffix) -MF../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(DependSuffix) -MM src/CMPluginBase.cpp -../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(PreprocessSuffix): src/contacts.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app/src_contacts.cpp$(PreprocessSuffix) src/contacts.cpp +../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(PreprocessSuffix): src/CMPluginBase.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) ../../codelite/build-$(ConfigurationName)/__/src/mir_app/src_CMPluginBase.cpp$(PreprocessSuffix) src/CMPluginBase.cpp --include ../../../../../home/ghazan/miranda-ng/codelite/build-$(ConfigurationName)/__/__/__/__/var/www/miranda-ng/src/mir_app//*$(DependSuffix) +-include ../../codelite/build-$(ConfigurationName)/__/src/mir_app//*$(DependSuffix) ## ## Clean ## diff --git a/src/mir_app/mir_app.project b/src/mir_app/mir_app.project index 98aaad6838..0d7dee9b74 100644 --- a/src/mir_app/mir_app.project +++ b/src/mir_app/mir_app.project @@ -3,12 +3,9 @@ - + - - - diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index f2f53dbb61..275e72b65e 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -105,9 +105,9 @@ static bool showProfileManager(void) return (mir_wstrcmpi(Mgr, L"yes") == 0); } -bool shouldAutoCreate(wchar_t *szProfile) +bool shouldAutoCreate(const MFilePath &szProfile) { - if (szProfile[0] == 0) + if (szProfile.IsEmpty()) return false; wchar_t ac[32]; @@ -115,7 +115,7 @@ bool shouldAutoCreate(wchar_t *szProfile) return mir_wstrcmpi(ac, L"yes") == 0; } -static void getDefaultProfile(wchar_t *szProfile, size_t cch) +static void getDefaultProfile(MFilePath &szProfile) { wchar_t defaultProfile[MAX_PATH]; Profile_GetSetting(L"Database/DefaultProfile", defaultProfile); @@ -125,13 +125,13 @@ static void getDefaultProfile(wchar_t *szProfile, size_t cch) VARSW res(defaultProfile); if (res) - mir_snwprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat"); + szProfile.Format(L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat"); else - szProfile[0] = 0; + szProfile.Empty(); } // returns 1 if something that looks like a profile is there -static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_t cch) +static void loadProfileByShortName(const wchar_t *src, MFilePath &szProfile) { wchar_t buf[MAX_PATH]; wcsncpy_s(buf, src, _TRUNCATE); @@ -148,8 +148,9 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_ wcsncpy_s(profileName, p, _TRUNCATE); p = wcsrchr(profileName, '.'); if (p) *p = 0; - mir_snwprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName); - PathToAbsoluteW(buf, szProfile, newProfileDir); + mir_snwprintf(newProfileDir, MAX_PATH, L"%s\\%s\\", g_profileDir, profileName); + szProfile.Truncate(MAX_PATH); + PathToAbsoluteW(buf, szProfile.GetBuffer(), newProfileDir); if (wcschr(buf, '\\')) { wcsncpy_s(g_profileDir, szProfile, _TRUNCATE); @@ -159,117 +160,108 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_ if (p && mir_wstrcmpi(p + 1, profileName) == 0) *p = 0; } - else szProfile[0] = 0; + else szProfile.Empty(); } } -void getProfileCmdLine(wchar_t *szProfile, size_t cch) +void getProfileCmdLine(MFilePath &szProfile) { LPCTSTR ptszProfileName = CmdLine_GetOption(L"profile"); if (ptszProfileName != nullptr) - loadProfileByShortName(ptszProfileName, szProfile, cch); + loadProfileByShortName(ptszProfileName, szProfile); } -void getProfileDefault(wchar_t *szProfile, size_t cch) +void getProfileDefault(MFilePath &szProfile) { if (g_defaultProfile != nullptr) { - loadProfileByShortName(g_defaultProfile, szProfile, cch); + loadProfileByShortName(g_defaultProfile, szProfile); mir_free(g_defaultProfile); } } // move profile from profile subdir -static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE) +static void moveProfileDirProfiles(const wchar_t *profiledir, bool isRootDir) { - wchar_t pfd[MAX_PATH]; + MFilePath pfd, path, path2; if (isRootDir) - wcsncpy_s(pfd, VARSW(L"%miranda_path%\\*.dat"), _TRUNCATE); + pfd = VARSW(L"%miranda_path%\\*.dat"); else - mir_snwprintf(pfd, L"%s\\*.dat", profiledir); - - WIN32_FIND_DATA ffd; - HANDLE hFind = FindFirstFile(pfd, &ffd); - if (hFind != INVALID_HANDLE_VALUE) { - wchar_t *c = wcsrchr(pfd, '\\'); if (c) *c = 0; - do { - wchar_t path[MAX_PATH], path2[MAX_PATH]; - wchar_t* profile = mir_wstrdup(ffd.cFileName); - c = wcsrchr(profile, '.'); if (c) *c = 0; - mir_snwprintf(path, L"%s\\%s", pfd, ffd.cFileName); - mir_snwprintf(path2, L"%s\\%s", profiledir, profile); - CreateDirectoryTreeW(path2); - mir_snwprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName); - if (_waccess(path2, 0) == 0) { - wchar_t buf[512]; - mir_snwprintf(buf, - TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."), - path, path2); - MessageBox(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK); - } - else if (MoveFile(path, path2) == 0) { - wchar_t buf[512]; - mir_snwprintf(buf, - TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."), - path, path2); - MessageBox(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK); - mir_free(profile); - break; - } - mir_free(profile); - } while (FindNextFile(hFind, &ffd)); + pfd.Format(L"%s\\*.dat", profiledir); + + for (auto &it: pfd.search()) { + int idx = pfd.ReverseFind('\\'); + if (idx != -1) + pfd.Trim(idx); + + auto *wszFileName = NEWWSTR_ALLOCA(it.m_path); + auto *c = wcsrchr(wszFileName, '.'); if (c) *c = 0; + + path.Format(L"%s\\%s", pfd.c_str(), wszFileName); + path2.Format(L"%s\\%s", profiledir, wszFileName); + CreateDirectoryTreeW(path2); + + path2.AppendFormat(L"\\%s.dat", wszFileName); + if (path2.isExist()) { + wchar_t buf[512]; + mir_snwprintf(buf, + TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."), + path, path2); + MessageBoxW(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK); + } + else if (!path.move(path2)) { + wchar_t buf[512]; + mir_snwprintf(buf, + TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."), + path, path2); + MessageBoxW(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK); + break; + } } - FindClose(hFind); } // returns 1 if a single profile (full path) is found within the profile dir -static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL * noProfiles) +static int getProfile1(MFilePath &szProfile, wchar_t *profiledir, BOOL * noProfiles) { int found = 0; if (IsInsideRootDir(profiledir, false)) - moveProfileDirProfiles(profiledir); - moveProfileDirProfiles(profiledir, FALSE); + moveProfileDirProfiles(profiledir, true); + moveProfileDirProfiles(profiledir, false); bool bNoDefaultProfile = (*szProfile == 0); - bool reqfd = !bNoDefaultProfile && (_waccess(szProfile, 0) == 0 || shouldAutoCreate(szProfile)); + bool reqfd = !bNoDefaultProfile && (szProfile.isExist() || shouldAutoCreate(szProfile)); bool bShowProfileManager = showProfileManager(); if (reqfd) found++; if (bShowProfileManager || !reqfd) { - wchar_t searchspec[MAX_PATH]; - mir_snwprintf(searchspec, L"%s\\*.*", profiledir); - - WIN32_FIND_DATA ffd; - HANDLE hFind = FindFirstFile(searchspec, &ffd); - if (hFind != INVALID_HANDLE_VALUE) { - do { - // make sure the first hit is actually a *.dat file - if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_wstrcmp(ffd.cFileName, L".") || !mir_wstrcmp(ffd.cFileName, L"..")) - continue; - - wchar_t newProfile[MAX_PATH]; - mir_snwprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName); - if (_waccess(newProfile, 0) != 0) - continue; - - switch (touchDatabase(newProfile, nullptr)) { - case EGROKPRF_CANTREAD: - // profile might be locked by another Miranda - if (!Profile_CheckOpened(newProfile)) - break; - __fallthrough; - - case 0: - case EGROKPRF_OBSOLETE: - if (++found == 1 && bNoDefaultProfile) - wcsncpy_s(szProfile, cch, newProfile, _TRUNCATE); + MFilePath searchspec; + searchspec.Format(L"%s\\*.*", profiledir); + + for (auto &it: searchspec.search()) { + // make sure the first hit is actually a *.dat file + if (!it.isDir()) + continue; + + MFilePath newProfile; + newProfile.Format(L"%s\\%s\\%s.dat", profiledir, it.m_path, it.m_path); + if (!newProfile.isExist()) + continue; + + switch (touchDatabase(newProfile, nullptr)) { + case EGROKPRF_CANTREAD: + // profile might be locked by another Miranda + if (!Profile_CheckOpened(newProfile)) break; - } - } while (FindNextFile(hFind, &ffd)); + __fallthrough; - FindClose(hFind); + case 0: + case EGROKPRF_OBSOLETE: + if (++found == 1 && bNoDefaultProfile) + szProfile = newProfile; + break; + } } reqfd = (!bShowProfileManager && found == 1 && bNoDefaultProfile); } @@ -278,15 +270,15 @@ static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL *noProfiles = (found == 0); if (bNoDefaultProfile && !reqfd) - szProfile[0] = 0; + szProfile.Empty(); return reqfd; } // returns 1 if a default profile should be selected instead of showing the manager. -static int getProfileAutoRun(wchar_t *szProfile) +static int getProfileAutoRun(MFilePath &szProfile) { - if (*szProfile == 0) + if (szProfile.IsEmpty()) return false; wchar_t Mgr[32]; @@ -298,28 +290,28 @@ static int getProfileAutoRun(wchar_t *szProfile) } // returns 1 if a profile was selected -static int getProfile(wchar_t *szProfile, size_t cch) +static int getProfile(MFilePath &szProfile) { getProfilePath(g_profileDir, _countof(g_profileDir)); if (IsInsideRootDir(g_profileDir, true)) if (WritePrivateProfileString(L"Database", L"ProfileDir", L"", mirandabootini)) getProfilePath(g_profileDir, _countof(g_profileDir)); - getDefaultProfile(szProfile, cch); - getProfileCmdLine(szProfile, cch); - getProfileDefault(szProfile, cch); + getDefaultProfile(szProfile); + getProfileCmdLine(szProfile); + getProfileDefault(szProfile); if (IsInsideRootDir(g_profileDir, true)) { - MessageBox(nullptr, - TranslateT("Profile cannot be placed into Miranda root folder.\nPlease move Miranda profile to some other location."), - LPGENW("Miranda NG"), MB_ICONERROR | MB_OK); + MessageBoxW(nullptr, + TranslateT("Profile cannot be placed into Miranda root folder.\nPlease move Miranda profile to some other location."), + LPGENW("Miranda NG"), MB_ICONERROR | MB_OK); return 0; } PROFILEMANAGERDATA pd = {}; if (CmdLine_GetOption(L"ForceShowPM")) { LBL_Show: - pd.ptszProfile = szProfile; + pd.ptszProfile = szProfile.GetBuffer(); pd.ptszProfileDir = g_profileDir; if (!getProfileManager(&pd)) return 0; @@ -330,7 +322,7 @@ LBL_Show: if (getProfileAutoRun(szProfile)) return 1; - if (getProfile1(szProfile, cch, g_profileDir, &pd.noProfiles)) + if (getProfile1(szProfile, g_profileDir, &pd.noProfiles)) return 1; goto LBL_Show; @@ -344,7 +336,7 @@ char* makeFileName(const wchar_t* tszOriginalName) wchar_t *tszFileName = mir_a2u(szFileName); if (mir_wstrcmp(tszOriginalName, tszFileName)) { wchar_t tszProfile[MAX_PATH]; - if (GetShortPathName(tszOriginalName, tszProfile, MAX_PATH) != 0) + if (GetShortPathNameW(tszOriginalName, tszProfile, MAX_PATH) != 0) szResult = mir_u2a(tszProfile); } @@ -384,7 +376,7 @@ int tryOpenDatabase(const wchar_t *tszProfile) for (auto &it : arDbPlugins) { // liked the profile? int err = it->grokHeader(tszProfile); - if (err != ERROR_SUCCESS) { // smth went wrong + if (err != EGROKPRF_NOERROR) { // smth went wrong switch (err) { case EGROKPRF_CANTREAD: case EGROKPRF_UNKHEADER: @@ -422,7 +414,7 @@ static int tryCreateDatabase(const wchar_t *ptszProfile) continue; int err = p->makeDatabase(ptszProfile); - if (err == ERROR_SUCCESS) { + if (err == EGROKPRF_NOERROR) { g_bDbCreated = true; MDatabaseCommon *pDb = p->Load(ptszProfile, FALSE); if (pDb == nullptr) // driver was found but smth went wrong @@ -440,12 +432,14 @@ static int tryCreateDatabase(const wchar_t *ptszProfile) static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) { - wchar_t classname[256]; - if (GetClassName(hwnd, classname, _countof(classname)) && mir_wstrcmp(L"Miranda", classname) == 0) { - DWORD_PTR res = 0; - if (SendMessageTimeout(hwnd, uMsgProcessProfile, lParam, 0, SMTO_ABORTIFHUNG, 100, &res) && res) - return FALSE; - } + #ifdef _WINDOWS + wchar_t classname[256]; + if (GetClassName(hwnd, classname, _countof(classname)) && mir_wstrcmp(L"Miranda", classname) == 0) { + DWORD_PTR res = 0; + if (SendMessageTimeout(hwnd, uMsgProcessProfile, lParam, 0, SMTO_ABORTIFHUNG, 100, &res) && res) + return FALSE; + } + #endif return TRUE; } @@ -457,9 +451,9 @@ static INT_PTR CompactMe(void* obj, WPARAM, LPARAM) { auto *db = (MDatabaseCommon *)obj; if (!db->Compact()) - MessageBox(0, TranslateT("Database was compacted successfully"), TranslateT("Database"), MB_OK | MB_ICONINFORMATION); + MessageBoxW(0, TranslateT("Database was compacted successfully"), TranslateT("Database"), MB_OK | MB_ICONINFORMATION); else - MessageBox(0, TranslateT("Database compaction failed"), TranslateT("Database"), MB_OK | MB_ICONERROR); + MessageBoxW(0, TranslateT("Database compaction failed"), TranslateT("Database"), MB_OK | MB_ICONERROR); return 0; } @@ -495,29 +489,33 @@ static wchar_t tszNoSuitableDriver[] = LPGENW("Miranda was unable to open '%s'\n int LoadDatabaseModule(void) { - wchar_t szProfile[MAX_PATH]; - PathToAbsoluteW(L".", szProfile); - _wchdir(szProfile); - szProfile[0] = 0; + wchar_t tmp[MAX_PATH]; + PathToAbsoluteW(L".", tmp); + _wchdir(tmp); // find out which profile to load - if (!getProfile(szProfile, _countof(szProfile))) + MFilePath szProfile; + if (!getProfile(szProfile)) return 1; - wchar_t *ptszFileName = wcsrchr(szProfile, '\\'); - ptszFileName = (ptszFileName) ? ptszFileName + 1 : szProfile; + auto *ptszFileName = wcsrchr(szProfile, '\\'); + ptszFileName = (ptszFileName) ? ptszFileName + 1 : szProfile.c_str(); if (arDbPlugins.getCount() == 0) { - MessageBox(nullptr, CMStringW(FORMAT, TranslateW(tszNoDrivers), ptszFileName), TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR); + MessageBoxW(nullptr, + CMStringW(FORMAT, TranslateW(tszNoDrivers), ptszFileName), + TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR); return 1; } // if this profile is already opened in another miranda, silently return if (Profile_CheckOpened(szProfile)) { - uMsgProcessProfile = RegisterWindowMessage(L"Miranda::ProcessProfile"); - ATOM aPath = GlobalAddAtom(szProfile); - EnumWindows(EnumMirandaWindows, (LPARAM)aPath); - GlobalDeleteAtom(aPath); + #ifdef _WINDOWS + uMsgProcessProfile = RegisterWindowMessage(L"Miranda::ProcessProfile"); + ATOM aPath = GlobalAddAtom(szProfile); + EnumWindows(EnumMirandaWindows, (LPARAM)aPath); + GlobalDeleteAtom(aPath); + #endif return 1; } @@ -526,26 +524,26 @@ int LoadDatabaseModule(void) int rc; do { retry = false; - if (_waccess(szProfile, 0) && shouldAutoCreate(szProfile)) + if (!szProfile.isExist() && shouldAutoCreate(szProfile)) rc = tryCreateDatabase(szProfile); else rc = tryOpenDatabase(szProfile); // there were no suitable driver installed if (rc == -1) { - MessageBox(nullptr, + MessageBoxW(nullptr, CMStringW(FORMAT, TranslateW(tszNoSuitableDriver), ptszFileName), TranslateT("Miranda can't open that profile"), MB_OK | MB_ICONERROR); } else if (rc > 0) { if (fileExist(szProfile)) { // file isn't locked, just no driver could open it. - MessageBox(nullptr, + MessageBoxW(nullptr, CMStringW(FORMAT, TranslateW(tszUnknownFormat), ptszFileName), TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR); } else - retry = IDRETRY == MessageBox(nullptr, + retry = IDRETRY == MessageBoxW(nullptr, CMStringW(FORMAT, TranslateW(tszProfileLocked), ptszFileName), TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR); } diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index a4fefc068a..68049037f1 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -165,7 +165,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp char *buf = LPSTR(dbei->pBlob) + sizeof(uint32_t); ptrW tszFileName(getEventString(dbei, buf)); ptrW tszDescription(getEventString(dbei, buf)); - CMStringW wszText(tszFileName); + CMStringW wszText(tszFileName.get()); if (mir_wstrlen(tszDescription) > 0) { wszText.Append(L": "); wszText.Append(tszDescription); diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index 081d4874a5..88f151282c 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -84,7 +84,7 @@ protected: void ViewIni_OnClick(CCtrlBase*) { ptrW szPath(m_iniName.GetText()); - #ifdef _WINDOWS_ + #ifdef _WINDOWS ShellExecute(m_hwnd, L"open", szPath, nullptr, nullptr, SW_SHOW); #endif } -- cgit v1.2.3