Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #228 from Smilex/master

Fixed Issue #210
  • Loading branch information...
commit fbff824460895eb3a8a8e52ae031a23ca7682204 2 parents 51e8290 + 84b59eb
@Jookia Jookia authored
View
7 src/static/util/code/UtilLinux.cpp
@@ -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
3  src/tests/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+
+add_subdirectory(util)
View
9 src/tests/util/CMakeLists.txt
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.