当前位置: 首页>>代码示例>>C++>>正文


C++ path::native方法代码示例

本文整理汇总了C++中fs::path::native方法的典型用法代码示例。如果您正苦于以下问题:C++ path::native方法的具体用法?C++ path::native怎么用?C++ path::native使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fs::path的用法示例。


在下文中一共展示了path::native方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: path_to_stream

    ostream::string path_to_stream(fs::path const& path)
    {
        cygwin_conv_path_t flags = CCP_WIN_W_TO_POSIX | CCP_RELATIVE;

        ssize_t size = cygwin_conv_path(flags, path.native().c_str(), NULL, 0);
        
        if (size < 0)
            throw conversion_error("Error converting windows path to cygwin.");

        boost::scoped_array<char> result(new char[size]);

        if(cygwin_conv_path(flags, path.native().c_str(), result.get(), size))
            throw conversion_error("Error converting windows path to cygwin.");

        return std::string(result.get());
    }
开发者ID:Cabriter,项目名称:abelkhan,代码行数:16,代码来源:native_text.cpp

示例2: make_cmake_cmd

 std::wstring make_cmake_cmd(const fs::path& cmake_exe,
                             const fs::path& cmake_script,
                             const std::vector<CMakeVariable>& pass_variables)
 {
     std::wstring cmd_cmake_pass_variables = Strings::join(L" ", pass_variables, [](auto&& v) { return v.s; });
     return Strings::wformat(
         LR"("%s" %s -P "%s")", cmake_exe.native(), cmd_cmake_pass_variables, cmake_script.generic_wstring());
 }
开发者ID:schmittjoseph,项目名称:vcpkg,代码行数:8,代码来源:vcpkglib.cpp

示例3: apk_path

std::vector<std::string> filestorage::get_file_list(const boost::filesystem::path &path) {
	std::vector<std::string> file_list;
	if (!path.empty()) {
		fs::path apk_path(path);
		fs::recursive_directory_iterator end;

		for (fs::recursive_directory_iterator i(apk_path); i != end; ++i) {
			const fs::path cp = (*i);
			std::string filename = extract_filename(cp.native());
			file_list.push_back(filename);
		}
	}
	return file_list;
}
开发者ID:tigusoft-vm,项目名称:antinet-before-yedino,代码行数:14,代码来源:filestorage.cpp

示例4: main

int main() {
  // clang-format off
  struct {
    std::string input;
    std::string expect;
  } TestCases[] = {
      {"", fs::current_path()},
      {".", fs::current_path()},
      {"/", "/"},
      {"/foo", "/foo"},
      {"/.", "/"},
      {"/./", "/"},
      {"a/b", fs::current_path() / "a/b"},
      {"a", fs::current_path() / "a"},
      {"a/b/", fs::current_path() / "a/b/"},
      {StaticEnv::File, StaticEnv::File},
      {StaticEnv::Dir, StaticEnv::Dir},
      {StaticEnv::SymlinkToDir, StaticEnv::Dir},
      {StaticEnv::SymlinkToDir / "dir2/.", StaticEnv::Dir / "dir2"},
      // FIXME? If the trailing separator occurs in a part of the path that exists,
      // it is ommitted. Otherwise it is added to the end of the result.
      {StaticEnv::SymlinkToDir / "dir2/./", StaticEnv::Dir / "dir2"},
      {StaticEnv::SymlinkToDir / "dir2/DNE/./", StaticEnv::Dir / "dir2/DNE/"},
      {StaticEnv::SymlinkToDir / "dir2", StaticEnv::Dir2},
      {StaticEnv::SymlinkToDir / "dir2/../dir2/DNE/..", StaticEnv::Dir2 / ""},
      {StaticEnv::SymlinkToDir / "dir2/dir3/../DNE/DNE2", StaticEnv::Dir2 / "DNE/DNE2"},
      {StaticEnv::Dir / "../dir1", StaticEnv::Dir},
      {StaticEnv::Dir / "./.", StaticEnv::Dir},
      {StaticEnv::Dir / "DNE/../foo", StaticEnv::Dir / "foo"}
  };
  // clang-format on
  int ID = 0;
  bool Failed = false;
  for (auto& TC : TestCases) {
    ++ID;
    fs::path p(TC.input);
    const fs::path output = fs::weakly_canonical(p);
    if (!PathEq(output, TC.expect)) {
      Failed = true;
      std::cerr << "TEST CASE #" << ID << " FAILED: \n";
      std::cerr << "  Input: '" << TC.input << "'\n";
      std::cerr << "  Expected: '" << TC.expect << "'\n";
      std::cerr << "  Output: '" << output.native() << "'";
      std::cerr << std::endl;
    }
  }
  return Failed;
}
开发者ID:lichray,项目名称:libcxx,代码行数:48,代码来源:weakly_canonical.pass.cpp

示例5: filename

std::string
C::filename (fs::path const &fn)
{
  return filename (fn.native ());
}
开发者ID:pippijn,项目名称:makequick,代码行数:5,代码来源:colours.cpp


注:本文中的fs::path::native方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。