OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::FileSystem Namespace Reference

Functions

bool IsResourcePath (FilePathView path) noexcept
 ファイルパスがリソースのパスであるかを返します。 More...
 
bool Exists (FilePathView path)
 指定されたパスのファイルまたはディレクトリが存在するかを返します。 More...
 
bool IsDirectory (FilePathView path)
 指定したパスのディレクトリが存在するかを返します。 More...
 
bool IsFile (FilePathView path)
 指定したパスのファイルが存在するかを返します。 More...
 
bool IsResource (FilePathView path)
 指定したパスのリソースが存在するかを返します。 More...
 
FilePath FullPath (FilePathView path)
 絶対パスを返します。 More...
 
Platform::NativeFilePath NativePath (FilePathView path)
 OS ネイティブの形式で表記された絶対パスを返します。 More...
 
String Extension (FilePathView path)
 ファイルの拡張子(.を含まない) を小文字にして返します。 More...
 
String FileName (FilePathView path)
 親ディレクトリを含まずに、ファイル名を返します。 More...
 
String BaseName (FilePathView path)
 親ディレクトリを含まずに、拡張子を除いたファイル名を返します。 More...
 
FilePath ParentPath (FilePathView path, size_t level=0)
 指定したパスの親ディレクトリを返します。 More...
 
FilePath ParentPath (FilePathView path, size_t level, FilePath &baseFullPath)
 指定したパスの親ディレクトリを返します。合わせて、渡したパスのフルパスを取得します。 More...
 
FilePath VolumePath (FilePathView path)
 
FilePath PathAppend (FilePathView lhs, FilePathView rhs)
 
bool IsEmptyDirectory (FilePathView path)
 指定したパスが空のディレクトリであるかを返します。 More...
 
int64 Size (FilePathView path)
 指定したファイルやディレクトリのサイズを返します。 More...
 
int64 FileSize (FilePathView path)
 ファイルのサイズを返します。 More...
 
Optional< DateTimeCreationTime (FilePathView path)
 ファイルの作成日時を取得します。 More...
 
Optional< DateTimeWriteTime (FilePathView path)
 ファイルの最終更新日時を取得します。 More...
 
Optional< DateTimeAccessTime (FilePathView path)
 ファイルの最終アクセス日時を取得します。 More...
 
Array< FilePathDirectoryContents (FilePathView path, Recursive recursive=Recursive::Yes)
 指定したディレクトリの中身(パス)を取得します。 More...
 
const FilePathInitialDirectory () noexcept
 実行ファイルを起動したディレクトリを返します。 More...
 
const FilePathModulePath () noexcept
 実行ファイルのフルパスを返します。 More...
 
FilePath CurrentDirectory ()
 現在のカレントディレクトリを返します。 More...
 
bool ChangeCurrentDirectory (FilePathView path)
 カレントディレクトリを変更します。 More...
 
const FilePathGetFolderPath (SpecialFolder folder)
 特殊フォルダのパスを返します。 More...
 
FilePath TemporaryDirectoryPath ()
 一時ファイルの保存に使えるフォルダのパスを返します。 More...
 
FilePath UniqueFilePath (FilePathView directory=TemporaryDirectoryPath())
 一時ファイル用に使えるファイルパスを返します。 More...
 
FilePath RelativePath (FilePathView path, FilePathView start=CurrentDirectory())
 相対パスを作成して返します。 More...
 
bool CreateDirectories (FilePathView path)
 ディレクトリを作成します。 More...
 
bool CreateParentDirectories (FilePathView path)
 指定したパスの親ディレクトリを作成します。 More...
 
bool Copy (FilePathView from, FilePathView to, CopyOption copyOption=CopyOption::Default)
 指定したファイルまたはディレクトリをコピーします。 More...
 
bool Remove (FilePathView path, AllowUndo allowUndo=AllowUndo::No)
 指定したファイルまたはディレクトリを削除します。 More...
 
bool RemoveContents (FilePathView path, AllowUndo allowUndo=AllowUndo::No)
 指定したディレクトリの中身を削除します。 More...
 
bool Rename (FilePathView from, FilePathView to)
 指定したファイルまたはディレクトリをリネームします。 More...
 

Function Documentation

◆ AccessTime()

Optional<DateTime> s3d::FileSystem::AccessTime ( FilePathView  path)

ファイルの最終アクセス日時を取得します。

Parameters
pathファイルパス
Returns
ファイルの最終アクセス日時。取得に失敗した場合 none

◆ BaseName()

String s3d::FileSystem::BaseName ( FilePathView  path)

親ディレクトリを含まずに、拡張子を除いたファイル名を返します。

Parameters
pathファイルパス
Remarks
例: "picture"
Returns
ファイル名。失敗した場合は空の文字列

◆ ChangeCurrentDirectory()

bool s3d::FileSystem::ChangeCurrentDirectory ( FilePathView  path)

カレントディレクトリを変更します。

Parameters
path新しいカレントディレクトリ
Returns
カレントディレクトリの変更に成功した場合 true, それ以外の場合は false

◆ Copy()

bool s3d::FileSystem::Copy ( FilePathView  from,
FilePathView  to,
CopyOption  copyOption = CopyOption::Default 
)

指定したファイルまたはディレクトリをコピーします。

Parameters
fromコピー元のパス
toコピー先のパス
copyOptionオプション
Returns
コピーに成功した場合 true, それ以外の場合は false

◆ CreateDirectories()

bool s3d::FileSystem::CreateDirectories ( FilePathView  path)

ディレクトリを作成します。

Parameters
path作成するディレクトリのパス
Remarks
間のディレクトリが存在しない場合は自動的に作成します。
Returns
作成に成功したか、すでに同名のディレクトリが存在する場合 true, それ以外の場合は false

◆ CreateParentDirectories()

bool s3d::FileSystem::CreateParentDirectories ( FilePathView  path)

指定したパスの親ディレクトリを作成します。

Parameters
pathパス
Remarks
間のディレクトリが存在しない場合は自動的に作成します。
Returns
作成に成功したか、すでに同名のディレクトリが存在する場合 true, それ以外の場合は false

◆ CreationTime()

Optional<DateTime> s3d::FileSystem::CreationTime ( FilePathView  path)

ファイルの作成日時を取得します。

Parameters
pathファイルパス
Returns
ファイルの作成日時。取得に失敗した場合 none

◆ CurrentDirectory()

FilePath s3d::FileSystem::CurrentDirectory ( )

現在のカレントディレクトリを返します。

Returns
現在のカレントディレクトリ

◆ DirectoryContents()

Array<FilePath> s3d::FileSystem::DirectoryContents ( FilePathView  path,
Recursive  recursive = Recursive::Yes 
)

指定したディレクトリの中身(パス)を取得します。

Parameters
pathディレクトリのパス
recursiveディレクトリの中身にあるディレクトリの中身も取得する場合は Recursive::Yes, それ以外の場合は Recursive::No
Returns
指定したディレクトリの中身(パス)の一覧

◆ Exists()

bool s3d::FileSystem::Exists ( FilePathView  path)

指定されたパスのファイルまたはディレクトリが存在するかを返します。

Parameters
pathパス
Returns
指定されたパスのファイルまたはディレクトリが存在場合 true, それ以外の場合は false

◆ Extension()

String s3d::FileSystem::Extension ( FilePathView  path)

ファイルの拡張子(.を含まない) を小文字にして返します。

Parameters
pathファイルパス
Remarks
例: "png"
Returns
小文字の拡張子。失敗した場合は空の文字列

◆ FileName()

String s3d::FileSystem::FileName ( FilePathView  path)

親ディレクトリを含まずに、ファイル名を返します。

Parameters
pathファイルパス
Remarks
例: "picture.png"
Returns
ファイル名。失敗した場合は空の文字列

◆ FileSize()

int64 s3d::FileSystem::FileSize ( FilePathView  path)

ファイルのサイズを返します。

Parameters
pathファイルパス
Remarks
FileSystem::Size() と異なり、ディレクトリのサイズは取得できません。
ファイルが存在しなかったり、空である場合は 0 を返します。
Returns
ファイルのサイズ

◆ FullPath()

FilePath s3d::FileSystem::FullPath ( FilePathView  path)

絶対パスを返します。

Parameters
pathパス
Remarks
実際に存在するファイルやディレクトリのパスである必要はありません
例: "C:/Users/Siv/Desktop/picture.png"
Returns
絶対パス。失敗した場合は空の文字列

◆ GetFolderPath()

const FilePath& s3d::FileSystem::GetFolderPath ( SpecialFolder  folder)

特殊フォルダのパスを返します。

Parameters
folder特殊フォルダの種類
Returns
特殊フォルダのパス。存在しない場合は空の文字列

◆ InitialDirectory()

const FilePath& s3d::FileSystem::InitialDirectory ( )
noexcept

実行ファイルを起動したディレクトリを返します。

Returns
実行ファイルを起動したディレクトリ

◆ IsDirectory()

bool s3d::FileSystem::IsDirectory ( FilePathView  path)

指定したパスのディレクトリが存在するかを返します。

Parameters
pathディレクトリのパス
Returns
指定したパスのディレクトリが存在する場合 true, それ以外の場合は false

◆ IsEmptyDirectory()

bool s3d::FileSystem::IsEmptyDirectory ( FilePathView  path)

指定したパスが空のディレクトリであるかを返します。

Parameters
pathパス
Returns
空のディレクトリである場合 true, それ以外の場合は false

◆ IsFile()

bool s3d::FileSystem::IsFile ( FilePathView  path)

指定したパスのファイルが存在するかを返します。

Parameters
pathファイルパス
Returns
指定したパスのファイルが存在する場合 true, それ以外の場合は false

◆ IsResource()

bool s3d::FileSystem::IsResource ( FilePathView  path)

指定したパスのリソースが存在するかを返します。

Parameters
pathリソースパス
Returns
指定したパスのリソースが存在する場合 true, それ以外の場合は false

◆ IsResourcePath()

bool s3d::FileSystem::IsResourcePath ( FilePathView  path)
noexcept

ファイルパスがリソースのパスであるかを返します。

Parameters
pathファイルパス
Remarks
実際に存在するリソースのパスである必要はありません
Returns
リソースのパスである場合 true, それ以外の場合は false

◆ ModulePath()

const FilePath& s3d::FileSystem::ModulePath ( )
noexcept

実行ファイルのフルパスを返します。

Returns
実行ファイルのフルパス

◆ NativePath()

Platform::NativeFilePath s3d::FileSystem::NativePath ( FilePathView  path)

OS ネイティブの形式で表記された絶対パスを返します。

Parameters
pathパス
Returns
OS ネイティブの形式で表記された絶対パス。失敗した場合は空の文字列

◆ ParentPath() [1/2]

FilePath s3d::FileSystem::ParentPath ( FilePathView  path,
size_t  level,
FilePath baseFullPath 
)

指定したパスの親ディレクトリを返します。合わせて、渡したパスのフルパスを取得します。

Parameters
pathパス
level親のレベル。大きいほど上位の親ディレクトリ
baseFullPath渡したパスのフルパスを格納する変数への参照
Returns
親ディレクトリ。失敗した場合は空の文字列

◆ ParentPath() [2/2]

FilePath s3d::FileSystem::ParentPath ( FilePathView  path,
size_t  level = 0 
)

指定したパスの親ディレクトリを返します。

Parameters
pathパス
level親のレベル。大きいほど上位の親ディレクトリ
Returns
親ディレクトリ。失敗した場合は空の文字列

◆ PathAppend()

FilePath s3d::FileSystem::PathAppend ( FilePathView  lhs,
FilePathView  rhs 
)

◆ RelativePath()

FilePath s3d::FileSystem::RelativePath ( FilePathView  path,
FilePathView  start = CurrentDirectory() 
)

相対パスを作成して返します。

Parameters
pathパス
start相対パスの基準となるパス
Returns
start からみた path の相対パス

◆ Remove()

bool s3d::FileSystem::Remove ( FilePathView  path,
AllowUndo  allowUndo = AllowUndo::No 
)

指定したファイルまたはディレクトリを削除します。

Parameters
path削除するパス
allowUndo削除したファイルやディレクトリをゴミ箱に送る場合 AllowUndo::Yes, それ以外の場合は AllowUndo::No
Returns
削除に成功した場合 true, それ以外の場合は false

◆ RemoveContents()

bool s3d::FileSystem::RemoveContents ( FilePathView  path,
AllowUndo  allowUndo = AllowUndo::No 
)

指定したディレクトリの中身を削除します。

Parameters
path中身を削除するディレクトリのパス
allowUndo削除したファイルやディレクトリをゴミ箱に送る場合 AllowUndo::Yes, それ以外の場合は AllowUndo::No
Remarks
この関数の実行後、指定したディレクトリは空の状態になります。
Returns
削除に成功した場合 true, それ以外の場合は false

◆ Rename()

bool s3d::FileSystem::Rename ( FilePathView  from,
FilePathView  to 
)

指定したファイルまたはディレクトリをリネームします。

Parameters
fromリネームするパス
toリネーム後のパス
Returns
リネームに成功した場合 true, それ以外の場合は false

◆ Size()

int64 s3d::FileSystem::Size ( FilePathView  path)

指定したファイルやディレクトリのサイズを返します。

Parameters
pathパス
Returns
ファイルやディレクトリのサイズ

◆ TemporaryDirectoryPath()

FilePath s3d::FileSystem::TemporaryDirectoryPath ( )

一時ファイルの保存に使えるフォルダのパスを返します。

Returns
一時ファイルの保存に使えるフォルダのパス

◆ UniqueFilePath()

FilePath s3d::FileSystem::UniqueFilePath ( FilePathView  directory = TemporaryDirectoryPath())

一時ファイル用に使えるファイルパスを返します。

Parameters
directory一時ファイルの保存に使うフォルダのパス
Returns
一時ファイル用に使えるファイルパス

◆ VolumePath()

FilePath s3d::FileSystem::VolumePath ( FilePathView  path)

◆ WriteTime()

Optional<DateTime> s3d::FileSystem::WriteTime ( FilePathView  path)

ファイルの最終更新日時を取得します。

Parameters
pathファイルパス
Returns
ファイルの最終更新日時。取得に失敗した場合 none