英語版
このページの英語版を見る

dmd.root.filename

パス名とファイル名を囲む。
Authors:

適用範囲 https://codecov.io/gh/dlang/dmd/src/master/src/dmd/root/filename.d

struct FileName;
パス名とファイル名をカプセル化する。
pure nothrow this(const char[] str);
static pure nothrow FileName create(const(char)* name);
static pure nothrow @nogc bool equals(const(char)* name1, const(char)* name2);

static pure nothrow @nogc bool equals(const char[] name1, const char[] name2);
プラットフォームの規則(大文字と小文字を区別するかどうか)に従って2つの名前を比較する
static pure nothrow @nogc bool absolute(const(char)* name);

static pure nothrow @nogc @safe bool absolute(const char[] name);
パスが絶対パスかどうかを判断する。
Parameters:
const(char)* name パス
Returns:
絶対パス名であれば true を返す。
static nothrow const(char)* toAbsolute(const(char)* name, const(char)* base = null);
指定された名前を絶対パスとして返す
Parameters:
const(char)* name パス
const(char)* base 相対パスである場合、名前の前に付加する絶対ベースパスを返す
Returns:
ベースに対する相対パスとして名前を絶対パスにする
static pure nothrow @nogc const(char)* ext(const(char)* str);

static pure nothrow @nogc @safe const(char)[] ext(const char[] str);
入力のスライスとしてファイル名の拡張子を決定する。
Parameters:
const(char)* str ファイル名
Returns: ファイル名拡張子(読み取り専用)。拡張子の「.」以降を指す。該当するものがなければ、nullを返す。
ファイル名拡張子(読み取り専用)。 拡張子の「.」以降を指す。 該当するものがない場合は、nullを返す。
static nothrow const(char)* removeExt(const(char)* str);

static nothrow const(char)[] removeExt(const char[] str);
拡張子を除いたファイル名を返す。

TODO スライスが至る所で使用され、\0 が想定されていない場合、 これはシンプルなスライスに変換できる。

Parameters:
const(char)* str ファイル名
Returns:
拡張子を除いたファイル名をmallocしたもの。
static nothrow const(char)[] sansExt(const char[] filename);
拡張子を除いたファイル名。
Parameters:
char[] filename ファイル名
Returns: スライス
スライス
static pure nothrow @nogc const(char)* name(const(char)* str);

static pure nothrow @nogc @safe const(char)[] name(const char[] str);
パスを除いたファイル名を返す(読み取り専用)。
static nothrow const(char)* path(const(char)* str);

static nothrow const(char)[] path(const char[] str);
strのパス部分を返す。 返された文字列は新たに割り当てられる。 パスには末尾のパス区切り文字は含まれない。
static nothrow const(char)[] replaceName(const char[] path, const char[] name);
パスのファイル名部分を置き換える。
static nothrow const(char)* combine(const(char)* path, const(char)* name);

static nothrow const(char)[] combine(const char[] path, const char[] name);
pathファイルを結合する name
Parameters:
const(char)* path 追加するパス
const(char)* name パスに追加する名前
Returns: xml-ph-0000@deepl.internalで終了する文字列で、これは組み合わせである。
\0 で終了する文字列は、 pathname 有効なパスを組み合わせたもの。
static nothrow void splitPath(int delegate(const(char)*) nothrow sink, const(char)* path);
(getenv("PATH") が返すような)パスを分割し、各部分を mem.xmalloc で確保する ダブルクォートと ~ を処理する 各部分を sink() に渡す
Parameters:
int delegate(const(char)*) nothrow sink パス部分をここに送る。sink()が0以外の値を返したら終了する。
const(char)* path 分割するパス。
static pure nothrow char[] addExt(const char[] name, const char[] ext);
拡張子を追加する extname、コンテンツに関係なく name
Parameters:
char[] name 拡張子を追加するパス
char[] ext 追加する拡張子(ピリオドは含めないこと)
Returns: 新たに割り当てられた文字列(xml-ph-0000@deepl.internal までお問い合わせください)
新たに割り当てられた文字列(FileName.free で入手可能)
static nothrow const(char)* defaultExt(const(char)* name, const(char)* ext);

static nothrow const(char)[] defaultExt(const char[] name, const char[] ext);
FileName::free()の戻り値(無料)
static nothrow const(char)* forceExt(const(char)* name, const(char)* ext);

static nothrow const(char)[] forceExt(const char[] name, const char[] ext);
FileName::free()の戻り値を解放する
static pure nothrow @nogc bool equalsExt(const(char)* name, const(char)* ext);

static pure nothrow @nogc bool equalsExt(const char[] name, const char[] ext);
Returns:
true if name拡張子が ext
const pure nothrow @nogc bool equalsExt(const(char)* ext);
拡張子が一致した場合、Return !=0。
static nothrow const(char)* searchPath(const ref Strings path, const(char)* name, bool cwd);
ファイルの検索パス。
Parameters: パス文字列の配列
Strings path パス文字列の配列
const(char)* name 検索対象のファイル
bool cwd true は、パスを検索する前にカレントディレクトリを検索することを意味する
Returns:
見つかった場合は、ファイル名とパスを結合し、それ以外はnullとする
static pure nothrow @nogc @safe size_t findReservedChar(const char[] name);
パスに予約文字が含まれているかどうかを判断する。
Parameters:
char[] name パス
Returns: パスに予約文字が含まれているかどうかを判断する。見つかった場合は、パス内の最初の予約文字のインデックス。見つからなかった場合は、size_t.max。
パス内の最初の予約文字のインデックス。見つかった場合はsize_t.max、それ以外は
static pure nothrow @nogc @safe bool refersToParentDir(const char[] name);
パスが親ディレクトリを参照しているかどうかを判断する。
Parameters:
char[] name パス
Returns:
パスが親ディレクトリへの参照 '..' を含む場合は true
static nothrow int exists(const(char)* name);

static nothrow int exists(const char[] name);
path が指し示すファイルが存在するかどうかを確認する
Returns: 0 存在しない場合 1 存在し、かつディレクトリではない場合 2 存在し、かつディレクトリである場合
0:存在しない場合 1:存在し、かつ、ディレクトリではない場合 2:存在し、かつ、ディレクトリである場合
static nothrow bool ensurePathExists(const char[] path);

static nothrow bool ensurePathExists(const(char)* path);
指定されたパスが存在することを確認する
ファイルまたはディレクトリへのパスを受け付ける。 前者の場合、ベースパス(包含ディレクトリへのパス)が 存在するかどうかが確認され、存在しない場合は作成される。 後者の場合、指定されたディレクトリが存在するかどうかが確認され、 必要に応じて作成される。
Parameters:
char[] path ファイルまたはディレクトリへのパス
Returns: ディレクトリが存在するか、または正常に作成された場合
true ディレクトリが存在するか、正常に作成された場合
static nothrow const(char)* canonicalName(const(char)* name);

static nothrow const(char)[] canonicalName(const char[] name);
名前の正規版を返す。 このコードはリスクが高い。
static pure nothrow void free(const(char)* str);
FileNameルーチンによって割り当てられたメモリを解放する