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


C++ FileSpec::GetDirectory方法代码示例

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


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

示例1:

bool
FileSpec::Equal (const FileSpec& a, const FileSpec& b, bool full)
{
    if (!full && (a.GetDirectory().IsEmpty() || b.GetDirectory().IsEmpty()))
        return a.m_filename == b.m_filename;
    else
        return a == b;
}
开发者ID:carlokok,项目名称:lldb,代码行数:8,代码来源:FileSpec.cpp

示例2: GetProgramFileSpec

bool
HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec)
{
    if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) &&
            !file_spec.IsRelativeToCurrentWorkingDirectory() &&
            file_spec.Exists())
        return true;
    file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory();
    return !file_spec.GetDirectory().IsEmpty();
}
开发者ID:CODECOMMUNITY,项目名称:lldb,代码行数:10,代码来源:HostInfoLinux.cpp

示例3: FileSpecMatchesAsBaseOrFull

    bool FileSpecMatchesAsBaseOrFull(const FileSpec &left,
                                     const FileSpec &right) const {
        // If the filenames don't match, the paths can't be equal
        if (!left.FileEquals(right))
            return false;
        // If BOTH have a directory, also compare the directories.
        if (left.GetDirectory() && right.GetDirectory())
            return left.DirectoryEquals(right);

        // If one has a directory but not the other, they match.
        return true;
    }
开发者ID:krytarowski,项目名称:lldb,代码行数:12,代码来源:SymbolFilePDBTests.cpp

示例4:

Error
Platform::ResolveExecutable (const FileSpec &exe_file,
                             const ArchSpec &exe_arch,
                             lldb::ModuleSP &exe_module_sp)
{
    Error error;
    if (exe_file.Exists())
    {
        if (exe_arch.IsValid())
        {
            error = ModuleList::GetSharedModule (exe_file, 
                                                 exe_arch, 
                                                 NULL,
                                                 NULL, 
                                                 0, 
                                                 exe_module_sp, 
                                                 NULL, 
                                                 NULL);
        }
        else
        {
            // No valid architecture was specified, ask the platform for
            // the architectures that we should be using (in the correct order)
            // and see if we can find a match that way
            ArchSpec platform_arch;
            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
            {
                error = ModuleList::GetSharedModule (exe_file, 
                                                     platform_arch, 
                                                     NULL,
                                                     NULL, 
                                                     0, 
                                                     exe_module_sp, 
                                                     NULL, 
                                                     NULL);
                // Did we find an executable using one of the 
                if (error.Success() && exe_module_sp)
                    break;
            }
        }
    }
    else
    {
        error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
                                        exe_file.GetDirectory().AsCString(""),
                                        exe_file.GetDirectory() ? "/" : "",
                                        exe_file.GetFilename().AsCString(""));
    }
    return error;
}
开发者ID:fbsd,项目名称:old_lldb,代码行数:50,代码来源:Platform.cpp

示例5: locker

TargetSP
TargetList::FindTargetWithExecutableAndArchitecture
(
    const FileSpec &exe_file_spec,
    const ArchSpec *exe_arch_ptr
) const
{
    Mutex::Locker locker (m_target_list_mutex);
    TargetSP target_sp;
    bool full_match = (bool)exe_file_spec.GetDirectory();

    collection::const_iterator pos, end = m_target_list.end();
    for (pos = m_target_list.begin(); pos != end; ++pos)
    {
        Module *exe_module = (*pos)->GetExecutableModulePointer();

        if (exe_module)
        {
            if (FileSpec::Equal (exe_file_spec, exe_module->GetFileSpec(), full_match))
            {
                if (exe_arch_ptr)
                {
                    if (!exe_arch_ptr->IsCompatibleMatch(exe_module->GetArchitecture()))
                        continue;
                }
                target_sp = *pos;
                break;
            }
        }
    }
    return target_sp;
}
开发者ID:ksarada,项目名称:NyuziToolchain,代码行数:32,代码来源:TargetList.cpp

示例6: temp_file

bool
HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec)
{
    FileSpec temp_file("/opt/local/include/lldb", false);
    file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
    return true;
}
开发者ID:wiltonlazary,项目名称:swift-lldb,代码行数:7,代码来源:HostInfoPosix.cpp

示例7: save_socket_id_to_file

static Error save_socket_id_to_file(const std::string &socket_id,
                                    const FileSpec &file_spec) {
  FileSpec temp_file_spec(file_spec.GetDirectory().AsCString(), false);
  auto error = FileSystem::MakeDirectory(temp_file_spec,
                                         eFilePermissionsDirectoryDefault);
  if (error.Fail())
    return Error("Failed to create directory %s: %s",
                 temp_file_spec.GetCString(), error.AsCString());

  llvm::SmallString<PATH_MAX> temp_file_path;
  temp_file_spec.AppendPathComponent("port-file.%%%%%%");
  auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetCString(),
                                                  temp_file_path);
  if (err_code)
    return Error("Failed to create temp file: %s", err_code.message().c_str());

  llvm::FileRemover tmp_file_remover(temp_file_path.c_str());

  {
    std::ofstream temp_file(temp_file_path.c_str(), std::ios::out);
    if (!temp_file.is_open())
      return Error("Failed to open temp file %s", temp_file_path.c_str());
    temp_file << socket_id;
  }

  err_code = llvm::sys::fs::rename(temp_file_path.c_str(), file_spec.GetPath());
  if (err_code)
    return Error("Failed to rename file %s to %s: %s", temp_file_path.c_str(),
                 file_spec.GetPath().c_str(), err_code.message().c_str());

  tmp_file_remover.releaseFile();
  return Error();
}
开发者ID:efcs,项目名称:lldb,代码行数:33,代码来源:lldb-platform.cpp

示例8:

//------------------------------------------------------------------
// Find the index of the file in the file spec list that matches
// "file_spec" starting "start_idx" entries into the file spec list.
//
// Returns the valid index of the file that matches "file_spec" if
// it is found, else UINT32_MAX is returned.
//------------------------------------------------------------------
uint32_t
FileSpecList::FindFileIndex (uint32_t start_idx, const FileSpec &file_spec, bool full) const
{
    const uint32_t num_files = m_files.size();
    uint32_t idx;

    // When looking for files, we will compare only the filename if the
    // FILE_SPEC argument is empty
    bool compare_filename_only = file_spec.GetDirectory().IsEmpty();

    for (idx = start_idx; idx < num_files; ++idx)
    {
        if (compare_filename_only)
        {
            if (m_files[idx].GetFilename() == file_spec.GetFilename())
                return idx;
        }
        else
        {
            if (FileSpec::Equal (m_files[idx], file_spec, full))
                return idx;
        }
    }

    // We didn't find the file, return an invalid index
    return UINT32_MAX;
}
开发者ID:carlokok,项目名称:lldb,代码行数:34,代码来源:FileSpecList.cpp

示例9: temp_file

bool
HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec)
{
    FileSpec temp_file("/usr/lib/lldb", true);
    file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
    return true;
}
开发者ID:CODECOMMUNITY,项目名称:lldb,代码行数:7,代码来源:HostInfoLinux.cpp

示例10: user_plugin_dir

bool
HostInfoLinux::ComputeUserPluginsDirectory(FileSpec &file_spec)
{
    // XDG Base Directory Specification
    // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
    // If XDG_DATA_HOME exists, use that, otherwise use ~/.local/share/lldb.
    const char *xdg_data_home = getenv("XDG_DATA_HOME");
    if (xdg_data_home && xdg_data_home[0])
    {
        std::string user_plugin_dir(xdg_data_home);
        user_plugin_dir += "/lldb";
        file_spec.GetDirectory().SetCString(user_plugin_dir.c_str());
    }
    else
        file_spec.GetDirectory().SetCString("~/.local/share/lldb");
    return true;
}
开发者ID:CODECOMMUNITY,项目名称:lldb,代码行数:17,代码来源:HostInfoLinux.cpp

示例11: Symlink

Error
ModuleCache::CreateHostSysRootModuleSymLink (const FileSpec &sysroot_module_path_spec, const FileSpec &module_file_path)
{
    const auto error = MakeDirectory (FileSpec (sysroot_module_path_spec.GetDirectory ().AsCString (), false));
    if (error.Fail ())
        return error;

    return FileSystem::Symlink (sysroot_module_path_spec.GetPath ().c_str (),
                                module_file_path.GetPath ().c_str ());
}
开发者ID:FulcronZ,项目名称:NyuziToolchain,代码行数:10,代码来源:ModuleCache.cpp

示例12: lldb_file_spec

bool
HostInfoBase::ComputeSharedLibraryDirectory(FileSpec &file_spec)
{
    // To get paths related to LLDB we get the path to the executable that
    // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB",
    // on linux this is assumed to be the "lldb" main executable. If LLDB on
    // linux is actually in a shared library (liblldb.so) then this function will
    // need to be modified to "do the right thing".

    FileSpec lldb_file_spec(
        Host::GetModuleFileSpecForHostAddress(reinterpret_cast<void *>(reinterpret_cast<intptr_t>(HostInfoBase::GetLLDBPath))));
    
    // This is necessary because when running the testsuite the shlib might be a symbolic link inside the Python resource dir.
    FileSystem::ResolveSymbolicLink(lldb_file_spec, lldb_file_spec);
    
    // Remove the filename so that this FileSpec only represents the directory.
    file_spec.GetDirectory() = lldb_file_spec.GetDirectory();

    return (bool)file_spec.GetDirectory();
}
开发者ID:Aj0Ay,项目名称:lldb,代码行数:20,代码来源:HostInfoBase.cpp

示例13: locker

uint32_t
Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
{
    Mutex::Locker locker (m_mutex);
    Timer scoped_timer(__PRETTY_FUNCTION__,
                       "Module::ResolveSymbolContextForFilePath (%s%s%s:%u, check_inlines = %s, resolve_scope = 0x%8.8x)",
                       file_spec.GetDirectory().AsCString(""),
                       file_spec.GetDirectory() ? "/" : "",
                       file_spec.GetFilename().AsCString(""),
                       line,
                       check_inlines ? "yes" : "no",
                       resolve_scope);

    const uint32_t initial_count = sc_list.GetSize();

    SymbolVendor *symbols = GetSymbolVendor  ();
    if (symbols)
        symbols->ResolveSymbolContext (file_spec, line, check_inlines, resolve_scope, sc_list);

    return sc_list.GetSize() - initial_count;
}
开发者ID:eightcien,项目名称:lldb,代码行数:21,代码来源:Module.cpp

示例14: ModuleUpdated

ModuleSP
Target::GetSharedModule
(
    const FileSpec& file_spec,
    const ArchSpec& arch,
    const lldb_private::UUID *uuid_ptr,
    const ConstString *object_name,
    off_t object_offset,
    Error *error_ptr
)
{
    // Don't pass in the UUID so we can tell if we have a stale value in our list
    ModuleSP old_module_sp; // This will get filled in if we have a new version of the library
    bool did_create_module = false;
    ModuleSP module_sp;

    // If there are image search path entries, try to use them first to acquire a suitable image.

    Error error;

    if (m_image_search_paths.GetSize())
    {
        FileSpec transformed_spec;
        if (m_image_search_paths.RemapPath (file_spec.GetDirectory(), transformed_spec.GetDirectory()))
        {
            transformed_spec.GetFilename() = file_spec.GetFilename();
            error = ModuleList::GetSharedModule (transformed_spec, arch, uuid_ptr, object_name, object_offset, module_sp, &old_module_sp, &did_create_module);
        }
    }

    // If a module hasn't been found yet, use the unmodified path.

    if (!module_sp)
    {
        error = (ModuleList::GetSharedModule (file_spec, arch, uuid_ptr, object_name, object_offset, module_sp, &old_module_sp, &did_create_module));
    }

    if (module_sp)
    {
        m_images.Append (module_sp);
        if (did_create_module)
        {
            if (old_module_sp && m_images.GetIndexForModule (old_module_sp.get()) != LLDB_INVALID_INDEX32)
                ModuleUpdated(old_module_sp, module_sp);
            else
                ModuleAdded(module_sp);
        }
    }
    if (error_ptr)
        *error_ptr = error;
    return module_sp;
}
开发者ID:eightcien,项目名称:lldb,代码行数:52,代码来源:Target.cpp

示例15: path

bool
HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)
{
    FileSpec lldb_file_spec;
    if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
        return false;
    llvm::SmallString<64> path(lldb_file_spec.GetDirectory().AsCString());
    llvm::sys::path::remove_filename(path);
    llvm::sys::path::append(path, "lib", "site-packages");
    std::replace(path.begin(), path.end(), '\\', '/');
    file_spec.GetDirectory().SetString(path.c_str());
    return true;
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:13,代码来源:HostInfoWindows.cpp


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