Permalink
Browse files

Merge pull request #228 from Smilex/master

Fixed Issue #210
  • Loading branch information...
2 parents 51e8290 + 84b59eb commit fbff824460895eb3a8a8e52ae031a23ca7682204 @Jookia Jookia committed May 24, 2012
Showing with 18 additions and 1 deletion.
  1. +6 −1 src/static/util/code/UtilLinux.cpp
  2. +3 −0 src/tests/CMakeLists.txt
  3. +9 −0 src/tests/util/CMakeLists.txt
@@ -688,12 +688,17 @@ std::string getCmdStdout(const char* command, int stdErrDest)
std::wstring getDesktopPath(std::wstring extra)
{
- std::wstring desktop((wchar_t*) getCmdStdout("xdg-user-dir DESKTOP", 1).c_str());
+ // Convert std::string to std::wstring using std::copy
+ std::string temp(getCmdStdout("xdg-user-dir DESKTOP", 1));
+ std::wstring desktop(temp.length(),L' ');
+ std::copy(temp.begin(), temp.end(), desktop.begin());
+ //std::wstring desktop((wchar_t*) getCmdStdout("xdg-user-dir DESKTOP", 1).c_str());
if(!desktop.empty())
{
desktop += L"/";
desktop += extra;
}
+ // Do some error checking if desktop is empty
return desktop;
}
View
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+
+add_subdirectory(util)
@@ -0,0 +1,9 @@
+message("-- Util tests --")
+
+find_package( Boost COMPONENTS test_exec_monitor unit_test_framework REQUIRED)
+
+add_executable(UtilLinux_test UtilLinux_test.cpp)
+
+add_dependencies(UtilLinux_test util)
+
+target_link_libraries(UtilLinux_test ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} util)

0 comments on commit fbff824

Please sign in to comment.