Re: [Vala] deleting folders
- From: Victor Eduardo <victor elementaryos org>
- To: "D.H. Bahr" <dbahr uci cu>
- Cc: Vala List <vala-list gnome org>
- Subject: Re: [Vala] deleting folders
- Date: Fri, 21 Sep 2012 19:11:52 -0006
You obviously can't, but you can do the following:
string file_name = file_info.get_name ();
var file = directory.get_child (file_name);
And after that, you can call file.delete().
Regards,
Victor.
On vie, sep 21, 2012 at 1:07 , D.H. Bahr <dbahr uci cu> wrote:
Hello everyone!
GLib.File provides a 'delete' method to delete files and empty folders.
I need to delete a non empty folder so I thought of a recursive method
like this:
bool remove_directory (string path) {
bool flag = false;
var directory = File.new_for_path (path);
var enumerator = directory.enumerate_children (
FileAttribute.STANDARD_NAME, 0
);
FileInfo file_info;
while ((file_info = enumerator.next_file ()) != null) {
if ((file_info.get_file_type ()) == FileType.DIRECTORY) {
/*
What should I do here?
How can I get a File from a FileInfo so I can use the
'delete' method on it?
*/
}
}
return flag;
}
Best regards,
D.H. Bahr
10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]