![]() |
Lumino
|
ファイルやディレクトリの作成、コピー、削除や列挙など、一般的な操作を提供します。 More...
#include <FileSystem.hpp>
Static Public Member Functions | |
static bool | existsFile (const StringRef &filePath) |
指定されたファイルが存在するか確認します。 More... | |
static FileAttribute | getAttribute (const StringRef &filePath) |
ファイルの属性を取得します。 More... | |
static void | setAttribute (const StringRef &filePath, FileAttribute attr) |
ファイルの属性を設定します。 More... | |
static void | copyFile (const StringRef &sourceFileName, const StringRef &destFileName, FileCopyOption option=FileCopyOption::None) |
ファイルをコピーします。 More... | |
static void | removeFile (const StringRef &filePath) |
ファイルを削除します。 More... | |
static bool | existsDirectory (const StringRef &path) |
指定したディレクトリが存在するかを確認します。 More... | |
static void | createDirectory (const StringRef &path) |
ディレクトリを作成します。 More... | |
static void | removeDirectory (const StringRef &path, bool recursive=false) |
ディレクトリを削除します。 More... | |
static void | copyDirectory (const StringRef &srcPath, const StringRef &dstPath, bool overwrite, bool recursive) |
ディレクトリをコピーします。 More... | |
static bool | matchPath (const StringRef &filePath, const StringRef &pattern) |
パスのファイル名とファイル名パターンを照合します。 | |
static uint64_t | getFileSize (const StringRef &filePath) |
ファイルサイズを取得します。 | |
static ByteBuffer | readAllBytes (const StringRef &filePath) |
ファイルの内容をバイナリ形式としてすべて読み込みます。 More... | |
static String | readAllText (const StringRef &filePath, TextEncoding *encoding=nullptr) |
ファイルの内容をテキスト形式としてすべて読み込ます。 More... | |
static void | writeAllBytes (const StringRef &filePath, const void *buffer, size_t size) |
指定されたバッファの内容をバイナリデータとしてすべてファイルに書き込みます。 More... | |
static void | writeAllText (const StringRef &filePath, const String &str, TextEncoding *encoding=nullptr) |
文字列をテキストデータとしてすべてファイルに書き込みます。 More... | |
static Path | getFile (const StringRef &dirPath, const StringRef &pattern=StringRef()) |
指定したディレクトリ内の1つのファイルパス返します。 More... | |
static DirectoryIteratorRange | getFiles (const StringRef &dirPath, const StringRef &pattern=StringRef(), SearchOption searchOption=SearchOption::TopDirectoryOnly) |
指定したディレクトリ内のファイルパス返します。 More... | |
static DirectoryIteratorRange | getDirectories (const StringRef &dirPath, const StringRef &pattern=StringRef(), SearchOption searchOption=SearchOption::TopDirectoryOnly) |
指定したディレクトリ内のディレクトリパス返します。 More... | |
ファイルやディレクトリの作成、コピー、削除や列挙など、一般的な操作を提供します。
|
static |
ディレクトリをコピーします。
[in] | srcPath | : コピー元ディレクトリパス |
[in] | dstPath | : コピー先ディレクトリパス |
[in] | overwrite | : コピー先のファイルとディレクトリを上書きする場合は true |
[in] | recursive | : 全てのサブディレクトリも含めて削除する場合は true |
|
static |
ファイルをコピーします。
[in] | sourceFileName | : コピー元ファイル名 |
[in] | destFileName | : コピー先ファイル名 |
[in] | option | : コピー先を上書きするかどうか |
|
static |
ディレクトリを作成します。
指定したパスへの全てのディレクトリを作成します。 例えば "a/b" を指定した場合、ディレクトリ a が無ければ作成してから、b を作成します。
|
static |
指定したディレクトリが存在するかを確認します。
[in] | path | : ディレクトリのパス |
|
static |
指定されたファイルが存在するか確認します。
この関数はファイルが存在し、かつ必要なアクセス許可を持つ場合 true を返します。
|
static |
ファイルの属性を取得します。
[in] | filePath | : ファイル名 |
|
static |
指定したディレクトリ内のディレクトリパス返します。
[in] | dirPath | : 検索するディレクトリのパス |
[in] | pattern | : ディレクトリ名の検索文字列 (ワイルドカード (* および ?) を含めることができます。省略した場合はすべてのファイルを列挙します) |
[in] | searchOption | : サブディレクトリも含めて検索するかどうか |
|
static |
指定したディレクトリ内の1つのファイルパス返します。
[in] | dirPath | : 検索するディレクトリのパス |
[in] | pattern | : ファイル名の検索文字列 (ワイルドカード (* および ?) を含めることができます。省略した場合はすべてのファイルを列挙します) |
これは getFiles() のユーティリティです。getFiles() で見つかった最初のファイルパスを返します。 特定の拡張子を持つファイルを1つだけ検索したい場合に使用します。
|
static |
指定したディレクトリ内のファイルパス返します。
[in] | dirPath | : 検索するディレクトリのパス |
[in] | pattern | : ファイル名の検索文字列 (ワイルドカード (* および ?) を含めることができます。省略した場合はすべてのファイルを列挙します) |
[in] | searchOption | : サブディレクトリも含めて検索するかどうか |
|
static |
ファイルの内容をバイナリ形式としてすべて読み込みます。
[in] | filePath | : 読み込むファイルのパス |
|
static |
ファイルの内容をテキスト形式としてすべて読み込ます。
[in] | filePath | : 読み込むファイルのパス |
[in] | encoding | : ファイルのエンコーディング (省略した場合、UTF8 テキストとして読み込みます) |
ファイル先頭に UTF 系の BOM が含まれている場合、それに対応するエンコーディングで読み込みます。
|
static |
ディレクトリを削除します。
[in] | path | : 削除するディレクトリのパス |
[in] | recursive | : 全てのサブディレクトリも含めて削除する場合は true |
|
static |
ファイルを削除します。
[in] | filePath | : 削除するファイルのパス |
削除するファイルが存在しない場合、例外はスローされません。
|
static |
ファイルの属性を設定します。
[in] | filePath | : ファイル名 |
[in] | attr | : ファイルの属性 (FileAttribute のビットの組み合わせ) |
この関数により変更できる属性は、読み取り属性のみです。(Unix では隠し属性はファイル名で表現されるためです) それ以外のフラグビットは無視されます。
|
static |
指定されたバッファの内容をバイナリデータとしてすべてファイルに書き込みます。
[in] | filePath | : 書き込み先のファイルのパス |
[in] | buffer | : バッファの先頭アドレス |
[in] | size | : バッファのバイト数 |
|
static |
文字列をテキストデータとしてすべてファイルに書き込みます。
[in] | filePath | : 書き込み先のファイルのパス |
[in] | str | : ファイルに書き込む文字列 |
[in] | encoding | : 文字列に適用するエンコーディング (省略した場合、UTF8 テキストとして書き込みます) |