summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Application/Unix/UnixApplication.h2
-rw-r--r--Swiften/Base/String.cpp5
-rw-r--r--Swiften/Base/String.h1
-rw-r--r--Swiften/Base/UnitTest/StringTest.cpp7
4 files changed, 14 insertions, 1 deletions
diff --git a/Swiften/Application/Unix/UnixApplication.h b/Swiften/Application/Unix/UnixApplication.h
index 8cf6feb..0b7bf67 100644
--- a/Swiften/Application/Unix/UnixApplication.h
+++ b/Swiften/Application/Unix/UnixApplication.h
@@ -16,7 +16,7 @@ namespace Swift {
}
boost::filesystem::path getSettingsDir() const {
- boost::filesystem::path result(getHomeDir() / ("." + getName().getUTF8String()));
+ boost::filesystem::path result(getHomeDir() / ("." + getName().getLowerCase().getUTF8String()));
boost::filesystem::create_directory(result);
return result;
}
diff --git a/Swiften/Base/String.cpp b/Swiften/Base/String.cpp
index 88692b7..52d1f2c 100644
--- a/Swiften/Base/String.cpp
+++ b/Swiften/Base/String.cpp
@@ -89,5 +89,10 @@ void String::replaceAll(char c, const String& s) {
}
}
+String String::getLowerCase() const {
+ std::string lower(data_);
+ std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
+ return String(lower);
+}
}
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index 0bc79bf..0da2e39 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -38,6 +38,7 @@ namespace Swift {
std::pair<String,String> getSplittedAtFirst(char c) const;
size_t getLength() const;
+ String getLowerCase() const;
void removeAll(char c);
diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp
index 0b7d207..2fa9f54 100644
--- a/Swiften/Base/UnitTest/StringTest.cpp
+++ b/Swiften/Base/UnitTest/StringTest.cpp
@@ -23,6 +23,7 @@ class StringTest : public CppUnit::TestFixture
CPPUNIT_TEST(testReplaceAll_LastChar);
CPPUNIT_TEST(testReplaceAll_ConsecutiveChars);
CPPUNIT_TEST(testReplaceAll_MatchingReplace);
+ CPPUNIT_TEST(testGetLowerCase);
CPPUNIT_TEST_SUITE_END();
public:
@@ -141,6 +142,12 @@ class StringTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(String("abbbc"), testling);
}
+
+ void testGetLowerCase() {
+ String testling("aBcD e");
+
+ CPPUNIT_ASSERT_EQUAL(String("abcd e"), testling.getLowerCase());
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);