Re: Help on g_spwan_async
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Harring Figueiredo <harringf yahoo com>
- Cc: gimpwin-dev yahoogroups com, gtk_list gtk gtk <gtk-app-devel-list gnome org>
- Subject: Re: Help on g_spwan_async
- Date: Tue, 19 Nov 2002 14:34:37 -0500
you could write a small `rm -rf` function
something like:
void rm(path) {
DIR = opendir(path)
while(readdir(DIR)) {
if (is a dir) {
rm(struct dirent.directory name); // call this same func
} else {
unlink();
}
}
}
I think this is all portable.
-Tristan
Harring Figueiredo wrote:
Folks,
I have the following code:
exe_string = g_strdup_printf("%s %s", rm_cmd, path);
g_print("Executing command: %s\n", exe_string);
if ( g_shell_parse_argv(exe_string ,&i, &exe_cmd , &error) != TRUE) {
*err = g_strdup(error->message);
g_error_free(error);
return FALSE;
}
ret_val = g_spawn_async_with_pipes(NULL, exe_cmd ,NULL,
G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_SEARCH_PATH,
NULL, NULL, &pid, NULL, NULL, NULL, &error);
rm_cmd = "deltree /Y" and path= "I:\somepath\somedir"
When I run the command on windowze, I can see the DOS console windows poping
up and desapearing; however, the directory never gets deleted.
IF I do an exact copy andpaty of the command that I output with g_print
above, the directory gets deleted.
What am I doing wrong here ?
NOTE: I am using this code because I need to delete anentire directory
structure on Windows and the remove() calls is only working for files -- I
guess it has a bug reported on the remove(3) man pages.
If anyone has a better suggestion that the code above, please drop me a line.
Note 2: compiled with mingwin gcc 2.95.3 (Windows binary from Tor's site.)
Thanks for any help.
Harring.
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]