Adding new_from_path.
This commit is contained in:
parent
854ba7fae4
commit
0d90b26603
@ -15,10 +15,18 @@ namespace Owl {
|
||||
return final_string;
|
||||
}
|
||||
|
||||
public static Owl.Path cwd () {
|
||||
return new Owl.Path (GLib.File.new_for_path ("."));
|
||||
}
|
||||
|
||||
public Path (GLib.File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public Path.from_path (string path) {
|
||||
this.file = GLib.File.new_for_path (path);
|
||||
}
|
||||
|
||||
public Path.tempdir () throws GLib.Error {
|
||||
this.is_tmp = true;
|
||||
var file = GLib.File.new_for_path(GLib.Environment.get_tmp_dir () + Config.WS + get_random_string ());
|
||||
|
@ -102,6 +102,14 @@ int main (string[] args) {
|
||||
GLib.Test.fail_printf ("%s\n", error.message);
|
||||
}
|
||||
});
|
||||
GLib.Test.add_func ("/test/owl/path-cwd", () => {
|
||||
try {
|
||||
var cwd = Owl.Path.cwd ();
|
||||
assert (cwd.child("src").exists ());
|
||||
} catch (GLib.Error error) {
|
||||
GLib.Test.fail_printf ("%s\n", error.message);
|
||||
}
|
||||
});
|
||||
|
||||
return GLib.Test.run ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user