예제 #1
0
TEST(QiOs, isProcessRunningRealProcessWithArgsUnicode)
{
  const std::string originalExecutable { "testlaunchloop" };
  const std::string originalExecutablePath = qi::path::findBin(originalExecutable);
  // we'll copy the originalExecutable to a unique file inside a unique direcory.
  // we re-use the unique directory name to build a unique file name.
  const qi::Path tmp = qi::Path(qi::os::mktmpdir());
  // japanese ideograms (specified by their unicode code point)
  // as an utf-8-encoded string (does not work on VS).
  //char utf8[] = u8"-\u30e6\u30cb\u30b3\u30fc\u30c9";
  // The same ideograms, specified by their utf-8 encoding
  char utf8[] = "-\xe3\x83\xa6\xe3\x83\x8b\xe3\x82\xb3\xe3\x83\xbc\xe3\x83\x89";
  const std::string executable = tmp.filename() + utf8;
  std::string executableWithExtension = executable;
#if BOOST_OS_WINDOWS && defined(NDEBUG)
    executableWithExtension += ".exe";
#elif BOOST_OS_WINDOWS && !defined(NDEBUG)
    executableWithExtension += "_d.exe";
#endif

  const qi::Path executablePathWithExtension =
          tmp / executableWithExtension;
  const qi::path::ScopedFile executableFile(executablePathWithExtension);
  boost::filesystem::copy(
        qi::Path(originalExecutablePath).bfsPath(),
        executablePathWithExtension.bfsPath());

  const std::vector<std::string> args { "nan", "mais", "allo", "quoi" };
  const ScopedProcess p{executablePathWithExtension.str(), args};
  ASSERT_TRUE(qi::os::isProcessRunning(p.pid(), executable));
}
예제 #2
0
파일: os.cpp 프로젝트: hejunbok/libqi
 void symlink(const qi::Path& source, const qi::Path& destination)
 {
   bfs::create_symlink(bfs::path(source.str(), qi::unicodeFacet()), bfs::path(destination.str(), qi::unicodeFacet()));
 }