@@ -897,33 +897,26 @@ public class SnapshotRepo : GLib.Object{
897897 // symlinks ----------------------------------------
898898
899899 public void create_symlinks (){
900- string cmd = " " ;
901- string std_out;
902- string std_err;
903- int ret_val;
904-
905900 cleanup_symlink_dir(" boot" );
906901 cleanup_symlink_dir(" hourly" );
907902 cleanup_symlink_dir(" daily" );
908903 cleanup_symlink_dir(" weekly" );
909904 cleanup_symlink_dir(" monthly" );
910905 cleanup_symlink_dir(" ondemand" );
911906
912- string path;
913-
914- foreach (var bak in snapshots){
915- foreach (string tag in bak. tags){
916-
917- path = " %s-%s " . printf(snapshots_path, tag);
918- cmd = " ln --symbolic \" ../snapshots/%s\" -t \"%s\" " . printf(bak. name, path);
919907
920- if (LOG_COMMANDS ) { log_debug(cmd); }
921-
922- ret_val = exec_sync(cmd, out std_out, out std_err);
923- if (ret_val != 0 ){
924- log_error (std_err);
925- log_error(_(" Failed to create symlinks" ) + " : snapshots-%s " . printf(tag));
926- return ;
908+ foreach (Snapshot bak in snapshots){
909+ foreach (string tag in bak. tags) {
910+ string linkTarget = " %s-%s /%s " . printf(snapshots_path, tag, bak. name);
911+ string linkValue = " ../snapshots/" + bak. name;
912+ try {
913+ File f = File . new_for_path(linkTarget);
914+ if (! f. make_symbolic_link(linkValue)) {
915+ log_error(_(" Failed to create symlinks" ) + " : %s " . printf(linkTarget));
916+ }
917+ } catch (Error e) {
918+ log_debug(e. message);
919+ log_error(_(" Failed to create symlinks" ) + " : %s " . printf(linkTarget));
927920 }
928921 }
929922 }
0 commit comments