diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-19 16:22:31 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-19 16:36:51 (GMT) |
commit | f416fe2749a959ad26544ead709683d3800059e4 (patch) | |
tree | 2813851a656f98300cba2dd7e1cf47597b19d891 | |
parent | b44ed4b36505ece31f29cdd0803af9949463f94b (diff) | |
download | swift-f416fe2749a959ad26544ead709683d3800059e4.zip swift-f416fe2749a959ad26544ead709683d3800059e4.tar.bz2 |
Extract dir providing functionality from application class.
24 files changed, 853 insertions, 129 deletions
diff --git a/.cdtproject b/.cdtproject deleted file mode 100644 index d815dfd..0000000 --- a/.cdtproject +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?eclipse-cdt version="2.0"?> - -<cdtproject id="org.eclipse.cdt.make.core.make"> -<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> -<data> -<item id="scannerConfiguration"> -<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> -<buildOutputProvider> -<openAction enabled="false" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="makefileGenerator"> -<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> -<parser enabled="false"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="false" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="false"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="false" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="false"/> -</scannerInfoProvider> -</profile> -</item> -<item id="org.eclipse.cdt.core.pathentry"> -<pathentry excluding=".git/|.sconf_temp/|3rdParty/" kind="src" path=""/> -<pathentry excluding=".sconf_temp/" kind="out" path=""/> -<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> -</item> -</data> -</cdtproject> diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..842628d --- /dev/null +++ b/.cproject @@ -0,0 +1,422 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?> + +<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="0.980756260"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.980756260" moduleId="org.eclipse.cdt.core.settings" name="Default"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.980756260" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg"> + <folderInfo id="0.980756260." name="/" resourcePath=""> + <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.2079360786" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> + <targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE;org.eclipse.cdt.core.GNU_ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.2079360786.2126769700" name=""/> + <builder arguments="${ProjDirPath}/3rdParty/SCons/scons.py" autoBuildTarget="" cleanBuildTarget="-c" command="python" enableAutoBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.966839094" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.libs.546611002" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.635361012" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1325611843" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.293253760" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1839221078" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.1351803006" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1975375926" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <scannerConfigBuildInfo instanceId="0.980756260"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + </scannerConfigBuildInfo> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> + </cconfiguration> + <cconfiguration id="0.980756260.1834106966"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.980756260.1834106966" moduleId="org.eclipse.cdt.core.settings" name="Unit tests"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.980756260.1834106966" name="Unit tests" parent="org.eclipse.cdt.build.core.prefbase.cfg"> + <folderInfo id="0.980756260.1834106966." name="/" resourcePath=""> + <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1171413969" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> + <targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE;org.eclipse.cdt.core.GNU_ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.1171413969.1006500186" name=""/> + <builder arguments="${ProjDirPath}/3rdParty/SCons/scons.py" autoBuildTarget="check=1" buildPath="" cleanBuildTarget="-c" command="python" enableAutoBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.1417638948" incrementalBuildTarget="check=1" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.libs.358970395" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.655623884" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1994670288" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.1108727159" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.463954066" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.569111652" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.966696268" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <scannerConfigBuildInfo instanceId="0.980756260"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + </scannerConfigBuildInfo> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="swift.null.189117846" name="swift"/> + </storageModule> +</cproject> diff --git a/.project b/.project new file mode 100644 index 0000000..31ac475 --- /dev/null +++ b/.project @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Swift</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <arguments> + <dictionary> + <key>?name?</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.append_environment</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.autoBuildTarget</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.buildArguments</key> + <value>${ProjDirPath}/3rdParty/SCons/scons.py</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.buildCommand</key> + <value>python</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> + <value>-c</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.contents</key> + <value>org.eclipse.cdt.make.core.activeConfigSettings</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableAutoBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableCleanBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableFullBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.fullBuildTarget</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.stopOnError</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> + <value>false</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> + <filteredResources> + <filter> + <id>1282232084903</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-*.obj</arguments> + </matcher> + </filter> + <filter> + <id>1282232084906</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-*.o</arguments> + </matcher> + </filter> + <filter> + <id>1282232084909</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-*.a</arguments> + </matcher> + </filter> + <filter> + <id>1282232084912</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-*.lib</arguments> + </matcher> + </filter> + <filter> + <id>1282232084914</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-*~</arguments> + </matcher> + </filter> + <filter> + <id>1282232084917</id> + <name></name> + <type>22</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-moc_*</arguments> + </matcher> + </filter> + <filter> + <id>1282231206287</id> + <name>3rdParty/Boost</name> + <type>26</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-src</arguments> + </matcher> + </filter> + </filteredResources> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..0c51e47 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Thu Aug 19 16:27:10 CEST 2010 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/BuildTools/Eclipse/Swift (Windows).launch b/BuildTools/Eclipse/Swift (Windows).launch new file mode 100644 index 0000000..bb27678 --- /dev/null +++ b/BuildTools/Eclipse/Swift (Windows).launch @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> +<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> +<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> +<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> +<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Swift/QtUI/Swift.exe"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="swift"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.980756260"/> +<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/swift"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<mapAttribute key="org.eclipse.debug.core.preferred_launchers"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> +<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> +</listAttribute> +</launchConfiguration> diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 22e78fe..f010c49 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -64,9 +64,8 @@ static const String CLIENT_VERSION = "1.0-devel"; static const String CLIENT_NODE = "http://swift.im"; -MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, bool useDelayForLatency) +MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency) : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), settings_(settings), loginWindow_(NULL), useDelayForLatency_(useDelayForLatency) { - application_ = application; presenceOracle_ = NULL; avatarManager_ = NULL; chatsManager_ = NULL; @@ -86,10 +85,11 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF timeBeforeNextReconnect_ = -1; mucSearchWindowFactory_ = mucSearchWindowFactory; eventWindowFactory_ = eventWindowFactory; + applicationMessageDisplay_ = applicationMessageDisplay; chatListWindowFactory_ = chatListWindowFactory; uiEventStream_ = new UIEventStream(); - avatarStorage_ = new AvatarFileStorage(application_->getAvatarDir()); + avatarStorage_ = avatarStorage; eventController_ = new EventController(); eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1)); @@ -249,7 +249,7 @@ void MainController::handleConnected() { } void MainController::handleEventQueueLengthChange(int count) { - application_->getApplicationMessageDisplay()->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); + applicationMessageDisplay_->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); } void MainController::reconnectAfterError() { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index f17bc9b..2bda61a 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -42,6 +42,7 @@ namespace Swift { class XMPPRosterController; class PresenceSender; class DiscoInfoResponder; + class ApplicationMessageDisplay; class AvatarManager; class LoginWindow; class EventLoop; @@ -64,7 +65,7 @@ namespace Swift { class MainController { public: - MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, bool useDelayForLatency); + MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency); ~MainController(); @@ -101,8 +102,8 @@ namespace Swift { LoginWindowFactory* loginWindowFactory_; EventWindowFactory* eventWindowFactory_; SettingsProvider *settings_; - Application* application_; AvatarStorage* avatarStorage_; + ApplicationMessageDisplay* applicationMessageDisplay_; ChatController* chatController_; XMPPRosterController* xmppRosterController_; RosterController* rosterController_; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 57b4edf..84ae3a1 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -21,7 +21,9 @@ #include <QSplitter> #include "Swiften/Application/Application.h" -#include "Swiften/Application/Platform/PlatformApplication.h" +#include "Swiften/Application/PlatformApplication.h" +#include "Swiften/Application/PlatformApplicationPathProvider.h" +#include "Swiften/Avatars/AvatarFileStorage.h" #include "Swiften/Base/String.h" #include "Swiften/Base/Platform.h" #include "Swiften/Elements/Presence.h" @@ -66,9 +68,11 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { int numberOfAccounts = options["multi-account"].as<int>(); - tabs_ = options.count("no-tabs") && !splitter_ > 0 ? NULL : new QtChatTabs(); + tabs_ = options.count("no-tabs") && !(splitter_ > 0) ? NULL : new QtChatTabs(); settings_ = new QtSettingsProvider(); application_ = new PlatformApplication(SWIFT_APPLICATION_NAME); + applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); + avatarStorage_ = new AvatarFileStorage(applicationPathProvider_->getAvatarDir()); chatWindowFactory_ = new QtChatWindowFactory(splitter_, settings_, tabs_); soundPlayer_ = new QtSoundPlayer(); if (splitter_) { @@ -90,7 +94,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { chatListWindowFactories_.push_back(chatListWindowFactory); QtMUCSearchWindowFactory* mucSearchWindowFactory = new QtMUCSearchWindowFactory(); mucSearchWindowFactories_.push_back(mucSearchWindowFactory); - MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, application_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, options.count("latency-debug") > 0); + MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, application_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, avatarStorage_, application_->getApplicationMessageDisplay(), options.count("latency-debug") > 0); mainControllers_.push_back(mainController); } diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h index 567af32..d205f9f 100644 --- a/Swift/QtUI/QtSwift.h +++ b/Swift/QtUI/QtSwift.h @@ -24,6 +24,8 @@ class QSplitter; namespace Swift { class AutoUpdater; class Application; + class ApplicationPathProvider; + class AvatarStorage; class MainController; class QtChatWindowFactory; class QtMainWindowFactory; @@ -57,6 +59,8 @@ namespace Swift { QtSoundPlayer* soundPlayer_; QtChatTabs* tabs_; Application* application_; + ApplicationPathProvider* applicationPathProvider_; + AvatarStorage* avatarStorage_; AutoUpdater* autoUpdater_; }; diff --git a/Swiften/Application/Application.cpp b/Swiften/Application/Application.cpp index d9f4a86..c9706aa 100644 --- a/Swiften/Application/Application.cpp +++ b/Swiften/Application/Application.cpp @@ -7,7 +7,6 @@ #include "Swiften/Application/Application.h" #include <iostream> -#include <boost/filesystem.hpp> #include <stdlib.h> #include "Swiften/Application/ApplicationMessageDisplay.h" @@ -20,23 +19,4 @@ Application::Application(const String& name) : name_(name) { Application::~Application() { } -boost::filesystem::path Application::getSettingsFileName() const { - return getSettingsDir() / "settings"; -} - -boost::filesystem::path Application::getAvatarDir() const { - return getSettingsDir() / "avatars"; -} - -boost::filesystem::path Application::getProfileDir(const String& profile) const { - boost::filesystem::path result(getHomeDir() / profile.getUTF8String()); - try { - boost::filesystem::create_directory(result); - } - catch (const boost::filesystem::filesystem_error& e) { - std::cerr << "ERROR: " << e.what() << std::endl; - } - return result; -} - } diff --git a/Swiften/Application/Application.h b/Swiften/Application/Application.h index e6205f1..98e2881 100644 --- a/Swiften/Application/Application.h +++ b/Swiften/Application/Application.h @@ -4,10 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_Application_H -#define SWIFTEN_Application_H - -#include <boost/filesystem.hpp> +#pragma once #include "Swiften/Base/String.h" @@ -19,12 +16,6 @@ namespace Swift { Application(const String& name); virtual ~Application(); - boost::filesystem::path getSettingsFileName() const; - boost::filesystem::path getAvatarDir() const; - virtual boost::filesystem::path getHomeDir() const = 0; - virtual boost::filesystem::path getSettingsDir() const = 0; - boost::filesystem::path getProfileDir(const String& profile) const; - const String& getName() const { return name_; } @@ -35,5 +26,3 @@ namespace Swift { String name_; }; } - -#endif diff --git a/Swiften/Application/ApplicationPathProvider.cpp b/Swiften/Application/ApplicationPathProvider.cpp new file mode 100644 index 0000000..ec19160 --- /dev/null +++ b/Swiften/Application/ApplicationPathProvider.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Application/Application.h" + +#include <boost/filesystem.hpp> +#include <iostream> + +#include "Swiften/Application/ApplicationPathProvider.h" + +namespace Swift { + +ApplicationPathProvider::ApplicationPathProvider(const String& applicationName) : applicationName(applicationName) { +} + +ApplicationPathProvider::~ApplicationPathProvider() { +} + +boost::filesystem::path ApplicationPathProvider::getSettingsFileName() const { + return getSettingsDir() / "settings"; +} + +boost::filesystem::path ApplicationPathProvider::getAvatarDir() const { + return getSettingsDir() / "avatars"; +} + +boost::filesystem::path ApplicationPathProvider::getProfileDir(const String& profile) const { + boost::filesystem::path result(getHomeDir() / profile.getUTF8String()); + try { + boost::filesystem::create_directory(result); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } + return result; +} + +} diff --git a/Swiften/Application/ApplicationPathProvider.h b/Swiften/Application/ApplicationPathProvider.h new file mode 100644 index 0000000..ba671ee --- /dev/null +++ b/Swiften/Application/ApplicationPathProvider.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/filesystem.hpp> + +#include "Swiften/Base/String.h" + +namespace Swift { + class ApplicationPathProvider { + public: + ApplicationPathProvider(const String& applicationName); + virtual ~ApplicationPathProvider(); + + boost::filesystem::path getSettingsFileName() const; + boost::filesystem::path getAvatarDir() const; + virtual boost::filesystem::path getHomeDir() const = 0; + virtual boost::filesystem::path getSettingsDir() const = 0; + boost::filesystem::path getProfileDir(const String& profile) const; + + protected: + const String& getApplicationName() const { + return applicationName; + } + + private: + String applicationName; + }; +} diff --git a/Swiften/Application/MacOSXApplicationPathProvider.cpp b/Swiften/Application/MacOSXApplicationPathProvider.cpp new file mode 100644 index 0000000..e679517 --- /dev/null +++ b/Swiften/Application/MacOSXApplicationPathProvider.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Application/MacOSXApplicationPathProvider.h" + +#include <iostream> + +namespace Swift { + +MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const String& name) : ApplicationPathProvider(name) { +} + +boost::filesystem::path MacOSXApplicationPathProvider::getSettingsDir() const { + try { + boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName().getUTF8String()); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } + boost::filesystem::create_directory(result); + return result; +} + +boost::filesystem::path MacOSXApplicationPathProvider::getHomeDir() const { + return boost::filesystem::path(getenv("HOME")); +} + +} diff --git a/Swiften/Application/MacOSXApplicationPathProvider.h b/Swiften/Application/MacOSXApplicationPathProvider.h new file mode 100644 index 0000000..c1d86d0 --- /dev/null +++ b/Swiften/Application/MacOSXApplicationPathProvider.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Application/ApplicationPathProvider.h" + +namespace Swift { + class MacOSXApplicationPathProvider : public ApplicationPathProvider { + public: + MacOSXApplicationPathProvider(const String& name); + + virtual boost::filesystem::path getHomeDir() const; + boost::filesystem::path getSettingsDir() const; + }; +} diff --git a/Swiften/Application/Platform/PlatformApplication.h b/Swiften/Application/PlatformApplication.h index 2508fb3..7facbe5 100644 --- a/Swiften/Application/Platform/PlatformApplication.h +++ b/Swiften/Application/PlatformApplication.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_PlatformApplication_H -#define SWIFTEN_PlatformApplication_H +#pragma once #include "Swiften/Base/Platform.h" @@ -16,15 +15,13 @@ namespace Swift { typedef MacOSXApplication PlatformApplication; } #elif defined(SWIFTEN_PLATFORM_WIN32) -#include "Swiften/Application/Windows/WindowsApplication.h" +#include "Swiften/Application/WindowsApplication.h" namespace Swift { typedef WindowsApplication PlatformApplication; } #else -#include "Swiften/Application/Unix/UnixApplication.h" +#include "Swiften/Application/UnixApplication.h" namespace Swift { typedef UnixApplication PlatformApplication; } #endif - -#endif diff --git a/Swiften/Application/PlatformApplicationPathProvider.h b/Swiften/Application/PlatformApplicationPathProvider.h new file mode 100644 index 0000000..e59bb9a --- /dev/null +++ b/Swiften/Application/PlatformApplicationPathProvider.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Base/Platform.h" + +#if defined(SWIFTEN_PLATFORM_MACOSX) +#include "Swiften/Application/MacOSXApplicationPathProvider.h" +namespace Swift { + typedef MacOSXApplicationPathProvider PlatformApplicationPathProvider; +} +#elif defined(SWIFTEN_PLATFORM_WIN32) +#include "Swiften/Application/WindowsApplicationPathProvider.h" +namespace Swift { + typedef WindowsApplicationPathProvider PlatformApplicationPathProvider; +} +#else +#include "Swiften/Application/UnixApplicationPathProvider.h" +namespace Swift { + typedef UnixApplicationPathProvider PlatformApplicationPathProvider; +} +#endif diff --git a/Swiften/Application/SConscript b/Swiften/Application/SConscript index 78b3a34..69e755a 100644 --- a/Swiften/Application/SConscript +++ b/Swiften/Application/SConscript @@ -3,6 +3,7 @@ Import("swiften_env") sources = [ "Application.cpp", "ApplicationMessageDisplay.cpp", + "ApplicationPathProvider.cpp", ] if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" : @@ -10,6 +11,11 @@ if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" : "MacOSX/MacOSXApplication.cpp", "MacOSX/MacOSXApplicationMessageDisplay.mm", "MacOSX/MacOSXApplicationInitializer.mm", + "MacOSX/MacOSXApplicationPathProvider.cpp", + ] +elif swiften_env["PLATFORM"] == "win32" : + sources += [ + "WindowsApplicationPathProvider.cpp" ] objects = swiften_env.StaticObject(sources) diff --git a/Swiften/Application/UnitTest/ApplicationTest.cpp b/Swiften/Application/UnitTest/ApplicationPathProviderTest.cpp index 8be3d4d..7cb277a 100644 --- a/Swiften/Application/UnitTest/ApplicationTest.cpp +++ b/Swiften/Application/UnitTest/ApplicationPathProviderTest.cpp @@ -7,22 +7,18 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include "Swiften/Application/Application.h" -#include "Swiften/Application/Platform/PlatformApplication.h" +#include "Swiften/Application/PlatformApplicationPathProvider.h" using namespace Swift; -class ApplicationTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(ApplicationTest); +class ApplicationPathProviderTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(ApplicationPathProviderTest); CPPUNIT_TEST(testGetSettingsDir); CPPUNIT_TEST_SUITE_END(); public: - ApplicationTest() {} - void setUp() { - testling_ = new PlatformApplication("SwiftTest"); + testling_ = new PlatformApplicationPathProvider("SwiftTest"); } void tearDown() { @@ -39,7 +35,7 @@ class ApplicationTest : public CppUnit::TestFixture } private: - Application* testling_; + ApplicationPathProvider* testling_; }; -CPPUNIT_TEST_SUITE_REGISTRATION(ApplicationTest); +CPPUNIT_TEST_SUITE_REGISTRATION(ApplicationPathProviderTest); diff --git a/Swiften/Application/Unix/UnixApplication.h b/Swiften/Application/UnixApplication.h index 56ee0ed..9ec9300 100644 --- a/Swiften/Application/Unix/UnixApplication.h +++ b/Swiften/Application/UnixApplication.h @@ -27,7 +27,7 @@ namespace Swift { } boost::filesystem::path getSettingsDir() const { - boost::filesystem::path result(getHomeDir() / ("." + getName().getLowerCase().getUTF8String())); + boost::filesystem::path result(getHomeDir() / ("." + getApplicationName().getLowerCase().getUTF8String())); try { boost::filesystem::create_directory(result); } diff --git a/Swiften/Application/UnixApplicationPathProvider.h b/Swiften/Application/UnixApplicationPathProvider.h new file mode 100644 index 0000000..04387f7 --- /dev/null +++ b/Swiften/Application/UnixApplicationPathProvider.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Application/ApplicationPathProvider.h" + +#include <iostream> + +namespace Swift { + class UnixApplicationPathProvider : public ApplicationPathProvider { + public: + UnixApplicationPathProvider(const String& name) : ApplicationPathProvider(name) { + } + + virtual boost::filesystem::path getHomeDir() const { + return boost::filesystem::path(getenv("HOME")); + } + + boost::filesystem::path getSettingsDir() const { + boost::filesystem::path result(getHomeDir() / ("." + getName().getLowerCase().getUTF8String())); + try { + boost::filesystem::create_directory(result); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } + return result; + } + }; +} + +#endif diff --git a/Swiften/Application/Windows/WindowsApplication.h b/Swiften/Application/WindowsApplication.h index fb0f5f1..eda066d 100644 --- a/Swiften/Application/Windows/WindowsApplication.h +++ b/Swiften/Application/WindowsApplication.h @@ -20,20 +20,6 @@ namespace Swift { return &messageDisplay_; } - boost::filesystem::path getSettingsDir() const { - char* appDirRaw = getenv("APPDATA"); - boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getName().getUTF8String()); - boost::filesystem::create_directory(result); - return result; - } - - boost::filesystem::path getHomeDir() const { - //FIXME: This should be My Documents - - char* homeDirRaw = getenv("USERPROFILE"); - return boost::filesystem::path(homeDirRaw); - } - private: NullApplicationMessageDisplay messageDisplay_; }; diff --git a/Swiften/Application/WindowsApplicationPathProvider.h b/Swiften/Application/WindowsApplicationPathProvider.h new file mode 100644 index 0000000..0d6862e --- /dev/null +++ b/Swiften/Application/WindowsApplicationPathProvider.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Application/ApplicationPathProvider.h" + +namespace Swift { + class WindowsApplicationPathProvider : public ApplicationPathProvider { + public: + WindowsApplicationPathProvider(const String& name); + + boost::filesystem::path getSettingsDir() const { + char* appDirRaw = getenv("APPDATA"); + boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName().getUTF8String()); + boost::filesystem::create_directory(result); + return result; + } + + boost::filesystem::path getHomeDir() const { + //FIXME: This should be My Documents + + char* homeDirRaw = getenv("USERPROFILE"); + return boost::filesystem::path(homeDirRaw); + } + }; +} diff --git a/Swiften/SConscript b/Swiften/SConscript index 866baa9..3d4d5f6 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -138,7 +138,7 @@ if env["SCONS_STAGE"] == "build" : myenv.StaticLibrary("Swiften", sources + swiften_env["SWIFTEN_OBJECTS"]) env.Append(UNITTEST_SOURCES = [ - File("Application/UnitTest/ApplicationTest.cpp"), + File("Application/UnitTest/ApplicationPathProviderTest.cpp"), File("Avatars/UnitTest/MockAvatarManager.cpp"), File("Avatars/UnitTest/AvatarManagerTest.cpp"), File("Base/UnitTest/IDGeneratorTest.cpp"), |