@@ -56,7 +56,7 @@ pub struct Path {
56
56
/// Returns `true` if `path` is a file.
57
57
#[inline]
58
58
pub func is_file(path: string) -> bool {
59
- return Self. exists(path) && !Self. is_directory(path);
59
+ return exists(path) && !is_directory(path);
60
60
}
61
61
62
62
/// Returns `true` if `path` is absolute.
@@ -142,7 +142,7 @@ pub struct Path {
142
142
/// Files that end with `.`, or that start with `.` and have no other `.` in their
143
143
/// name, are considered to have no extension.
144
144
pub func extension(path: string) -> string {
145
- filename := Self. file_name(path);
145
+ filename := file_name(path);
146
146
index := filename.last_index_of_byte('.') ?? return "";
147
147
return if index == 0 || index + 1 >= filename.len {
148
148
""
@@ -164,7 +164,7 @@ pub struct Path {
164
164
mut have_abs := false;
165
165
mut max_size: uint := 0;
166
166
for i, p in paths {
167
- if Self. is_absolute(p) {
167
+ if is_absolute(p) {
168
168
first_index = i;
169
169
have_abs = true;
170
170
max_size = 0;
@@ -234,8 +234,8 @@ pub struct Path {
234
234
/// resolve to the same path (after calling `resolve` on each), a zero-length
235
235
/// string is returned.
236
236
pub func relative(from_: string, to: string) -> !string {
237
- _ = Self. resolve(from_)!;
238
- _ = Self. resolve(to)!;
237
+ _ = resolve(from_)!;
238
+ _ = resolve(to)!;
239
239
mut from_it := from_.tokenize(SEPARATOR);
240
240
mut to_it := to.tokenize(SEPARATOR);
241
241
while {
@@ -315,8 +315,8 @@ pub struct Path {
315
315
if this_path.is_empty() {
316
316
continue;
317
317
}
318
- prev_sep := Self. is_separator(prev_path[prev_path.len - 1]);
319
- this_sep := Self. is_separator(this_path[0]);
318
+ prev_sep := is_separator(prev_path[prev_path.len - 1]);
319
+ this_sep := is_separator(this_path[0]);
320
320
sum += (!prev_sep && !this_sep).to_uint();
321
321
sum += if prev_sep && this_sep { this_path.len - 1 } else { this_path.len };
322
322
prev_path = this_path;
@@ -339,8 +339,8 @@ pub struct Path {
339
339
if this_path.is_empty() {
340
340
continue;
341
341
}
342
- prev_sep := Self. is_separator(prev_path[prev_path.len - 1]);
343
- this_sep := Self. is_separator(this_path[0]);
342
+ prev_sep := is_separator(prev_path[prev_path.len - 1]);
343
+ this_sep := is_separator(this_path[0]);
344
344
if !prev_sep && !this_sep {
345
345
unsafe {
346
346
buf[buf_index] = SEPARATOR;
@@ -369,13 +369,13 @@ pub struct Path {
369
369
if path.is_empty() {
370
370
return cwd;
371
371
}
372
- rpath := Self. resolve(path)!;
372
+ rpath := resolve(path)!;
373
373
if rpath == "." {
374
374
return cwd;
375
375
}
376
- if Self. is_absolute(rpath) {
376
+ if is_absolute(rpath) {
377
377
return rpath;
378
378
}
379
- return Self. resolve(Self. join(cwd, rpath)!)!;
379
+ return resolve(join(cwd, rpath)!)!;
380
380
}
381
381
}
0 commit comments