void vfu_user_external_archive_exec( VString &shell_line ) { VString tmpdir = vfu_temp(); if(mkdir( tmpdir, S_IRUSR|S_IWUSR|S_IXUSR /*|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH*/ )) { say1( "error: cannot create temp directory" ); say2( tmpdir ); return; } chdir( tmpdir ); VString fn = files_list[FLI]->full_name(); VString s; s = "rx_auto x \""; s += work_path; s += archive_name; s += "\" \""; s += fn; s += "\" 2> /dev/null"; vfu_shell( s, "" ); chdir( tmpdir ); /* FIXME: a little hack -- vfu_shell() changes current path */ str_replace( shell_line, "%f", fn ); str_replace( shell_line, "%F", fn ); vfu_shell( shell_line, "" ); chdir( work_path ); __vfu_dir_erase( tmpdir ); say1( "" ); }
void vfu_edit_conf_file() { if (opt.internal_editor) { opt.seo.cs = cINFO; SeeEditor editor( &opt.seo ); if( editor.open( filename_conf ) == 0 ) { int r = 1; while ( r ) { editor.run(); r = editor.request_quit(); } } else say1( "Error loading file..." ); editor.close(); } else { VString line = shell_editor; str_replace( line, "%f", filename_conf ); str_replace( line, "%F", filename_conf ); vfu_shell( line.data(), 0 ); } vfu_settings_save(); vfu_settings_load(); do_draw = 2; say1(""); say2(""); }
void vfu_extract_files( int one ) { if ( sel_count == 0 && one == 0 ) one = 1; char t[MAX_PATH]; VString target; if ( one == 0 ) sprintf( t, "EXTRACT SELECTION to: " ); else sprintf( t, "EXTRACT `%s' to:", files_list[FLI]->full_name() ); target = opt.last_copy_path[ CM_COPY ]; if ( !vfu_get_dir_name( t, target ) ) return; strcpy( opt.last_copy_path[ CM_COPY ], target ); VArray va; int z; for( z = 0; z < files_count; z++ ) if ((files_list[z]->sel && one == 0) || (z == FLI && one != 0)) va.push( files_list[z]->full_name() ); if (chdir(target)) { sprintf( t, "Cannot chdir to: %s", target.data() ); say1( t ); say2errno(); return; } VString tmpfile = vfu_temp(); if (va.fsave( tmpfile )) { sprintf( t, "Error writing list file: %s", tmpfile.data() ); say1( t ); return; } chmod( tmpfile, S_IRUSR|S_IWUSR ); VString s; s = "rx_auto x \""; s += work_path; s += archive_name; s += "\" @"; s += tmpfile; s += " 2> /dev/null"; vfu_shell( s, "" ); if (unlink( tmpfile )) { /* sprintf( t, "Cannot unlink/erase temp file: %s", tmpfile ); say2( t ); */ } if (chdir(work_path)) { sprintf( t, "Cannot chdir back to to: %s", work_path.data() ); say1( t ); say2errno(); return; } say1( "EXTRACT ok." ); };