Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tyanmahou committed Dec 11, 2024
1 parent 616e2db commit 7c3957c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Re-Abyss/app/debugs/Menu/MenuBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <abyss/utils/DebugMenu/HrItem.hpp>
#include <abyss/utils/Enum/EnumTraits.hpp>
#include <abyss/utils/FPS/FrameRateController.hpp>
#include <abyss/utils/FileUtil/FileUtil.hpp>
#include <Siv3D.hpp>

namespace
Expand Down Expand Up @@ -63,7 +64,7 @@ namespace
if (s3d::FileSystem::DirectoryContents(path).any([](const s3d::FilePath& p) {
return s3d::FileSystem::Extension(p) == U"tmx";
})) {
auto child = Node::Create<DebugMenu::Folder>(s3d::FileSystem::BaseName(path));
auto child = Node::Create<DebugMenu::Folder>(FileUtil::BaseName(path));
folder.add(BuildMainSceneChangeButtons(child, path));
}
continue;
Expand Down
18 changes: 16 additions & 2 deletions Re-Abyss/app/utils/FileUtil/FileUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/utils/FileUtil/FileUtil.hpp>
#include <abyss/utils/FileUtil/FileUtil.hpp>

#include <stack>
#include <Siv3D.hpp>
Expand All @@ -14,7 +14,21 @@ namespace

namespace abyss::FileUtil
{
s3d::FilePath FixRelativePath(const s3d::FilePath& path)
s3d::String BaseName(s3d::FilePathView path)
{
if (path.ends_with(U'/')) {
path.remove_suffix(1);
}
return s3d::FileSystem::BaseName(path);
}
s3d::String FileName(s3d::FilePathView path)
{
if (path.ends_with(U'/')) {
path.remove_suffix(1);
}
return s3d::FileSystem::FileName(path);
}
s3d::FilePath FixRelativePath(const s3d::FilePath& path)
{
std::stack<String> dirNameStack;
String dirName = U"";
Expand Down
7 changes: 5 additions & 2 deletions Re-Abyss/app/utils/FileUtil/FileUtil.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#pragma once
#pragma once
#include <Siv3D/String.hpp>

namespace abyss::FileUtil
{
s3d::String BaseName(s3d::FilePathView path);
s3d::String FileName(s3d::FilePathView path);

/// <summary>
/// 相対パスの ../ ./を排除する
/// ex Hoge/../Piyp/ => Hoge/
Expand Down Expand Up @@ -30,4 +33,4 @@ namespace abyss::FileUtil
#else
s3d::String FixPath(const s3d::FilePath& path, bool useResource = true);
#endif
}
}

0 comments on commit 7c3957c

Please sign in to comment.