Files
XCEngine/new_editor/app/Features/Project/ProjectBrowserModelInternal.h

63 lines
2.5 KiB
C++

#pragma once
#include "ProjectBrowserModel.h"
#include <filesystem>
#include <string>
#include <string_view>
#include <vector>
namespace XCEngine::UI::Editor::App::ProjectBrowserModelInternal {
inline constexpr std::string_view kAssetsRootId = "Assets";
std::string ToLowerCopy(std::string value);
std::string PathToUtf8String(const std::filesystem::path& path);
std::filesystem::path BuildPathFromUtf8(std::string_view value);
std::string NormalizePathSeparators(std::string value);
std::string BuildRelativeItemId(
const std::filesystem::path& path,
const std::filesystem::path& assetsRoot);
std::string BuildRelativeProjectPath(
const std::filesystem::path& path,
const std::filesystem::path& projectRoot);
std::string BuildAssetDisplayName(const std::filesystem::path& path, bool directory);
std::string BuildAssetNameWithExtension(const std::filesystem::path& path, bool directory);
bool IsMetaFile(const std::filesystem::path& path);
bool HasChildDirectories(const std::filesystem::path& folderPath);
std::vector<std::filesystem::path> CollectSortedChildDirectories(
const std::filesystem::path& folderPath);
std::wstring MakePathKey(const std::filesystem::path& path);
bool IsSameOrDescendantPath(
const std::filesystem::path& path,
const std::filesystem::path& ancestor);
std::string TrimAssetName(std::string_view name);
bool HasInvalidAssetName(std::string_view name);
std::filesystem::path MakeUniqueFolderPath(
const std::filesystem::path& parentPath,
std::string_view preferredName);
std::filesystem::path MakeUniqueFilePath(
const std::filesystem::path& parentPath,
const std::filesystem::path& preferredFileName);
std::string BuildRenamedEntryName(
const std::filesystem::path& sourcePath,
std::string_view requestedName);
std::filesystem::path GetMetaSidecarPath(const std::filesystem::path& assetPath);
void RemoveMetaSidecarIfPresent(const std::filesystem::path& assetPath);
bool RenamePathCaseAware(
const std::filesystem::path& sourcePath,
const std::filesystem::path& destPath);
void MoveMetaSidecarIfPresent(
const std::filesystem::path& sourcePath,
const std::filesystem::path& destPath);
bool MovePathWithOptionalMeta(
const std::filesystem::path& sourcePath,
const std::filesystem::path& destinationPath);
ProjectBrowserModel::ItemKind ResolveItemKind(
const std::filesystem::path& path,
bool directory);
bool CanOpenItemKind(ProjectBrowserModel::ItemKind kind);
bool CanPreviewItemKind(ProjectBrowserModel::ItemKind kind);
} // namespace XCEngine::UI::Editor::App::ProjectBrowserModelInternal