MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / GetPath

Method GetPath

PathCopyCopy/plugins/src/ShortFolderPlugin.cpp:62–85  ·  view source on GitHub ↗

Returns the short path of the specified file's parent directory. @param p_File File path. @return Short path of parent directory.

Source from the content-addressed store, hash-verified

60 // @return Short path of parent directory.
61 //
62 std::wstring ShortFolderPlugin::GetPath(const std::wstring& p_File) const
63 {
64 assert(m_pSettings != nullptr);
65
66 // Call parent to get the short path.
67 std::wstring shortPath = ShortPathPlugin::GetPath(p_File);
68
69 // If parent appended a separator, remove it here so that we
70 // can properly extract parent folder.
71 if (!shortPath.empty() && (shortPath.back() == L'\\' || shortPath.back() == L'/')) {
72 shortPath = shortPath.substr(0, shortPath.size() - 1);
73 }
74
75 // Extract parent directory.
76 PluginUtils::ExtractFolderFromPath(shortPath);
77
78 // If settings instructs us to append separator for directories, append one,
79 // since this plugin always returns directory paths.
80 if (m_pSettings != nullptr && m_pSettings->GetAppendSeparatorForDirectories()) {
81 shortPath += L"\\";
82 }
83
84 return shortPath;
85 }
86
87 //
88 // Determines if this plugin is androgynous. It is considered androgynous

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected