mirror of
https://github.com/aphrody-labs/terminal.git
synced 2026-10-13 22:05:20 +00:00
1 parent
d47adc8fc2
commit
dc8ae36584
2 files changed
+15
No files matched your search
@@ -128,6 +128,8 @@ namespace Microsoft::Console::Utils
|
||||
|
||||
const wchar_t* FindActionableControlCharacter(const wchar_t* beg, const size_t len) noexcept;
|
||||
|
||||
bool IsValidDirectory(const wchar_t* path) noexcept;
|
||||
|
||||
// Same deal, but in TerminalPage::_evaluatePathForCwd
|
||||
std::wstring EvaluateStartingDirectory(std::wstring_view cwd, std::wstring_view startingDirectory);
|
||||
|
||||
|
||||
@@ -1237,6 +1237,19 @@ plainSearch:
|
||||
return it;
|
||||
}
|
||||
|
||||
// Returns true if it's a valid path to a directory.
|
||||
bool Utils::IsValidDirectory(const wchar_t* path) noexcept
|
||||
{
|
||||
if (path == nullptr || *path == L'\0')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
const auto ok = GetFileAttributesExW(path, GetFileExInfoStandard, &data);
|
||||
return ok && (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
std::wstring Utils::EvaluateStartingDirectory(
|
||||
|
||||
Reference in new issue
Block a user