Author Topic: patch allowing subdir specific save options  (Read 8470 times)

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
patch allowing subdir specific save options
« on: June 30, 2006, 03:33:38 PM »
With this patch to saveload.e you can also setup subdir-specific save options (e.g. disable backup) in your VSLICK.ini (not only whole drives):

Code: [Select]
_str build_save_options(_str filename)
{
   _str options=def_save_options, option = '';
   _str env_options=get_env(_SLICKSAVE), env_option = '';
   _str driveprefix = substr (filename, 1, pathlen (filename));

   for (;;)
   {
     parse env_options with env_option option env_options;
     if (env_options=='' && env_option=='') break;
     if (pos (env_option, driveprefix, 1, 'I'))
     {
       options=options " " option;
       break;
     }
   }

   // HS2: orginal code
   // _str options=def_save_options;
   // _str env_options=get_env(_SLICKSAVE);
   // _str driveletter=substr(absolute(filename),1,1);
   // if ( env_options!='' && isalpha(driveletter) &&
   //   pos(driveletter'\:{?*}(?\:|$)',env_options,1,'ri')) {
   //   options=options " "substr(env_options,pos('S0'),pos('0'));
   // }

   _str ext=get_extension(filename);
   if ( pos(' .'ext' ',' 'def_tab_ext' ',1,_fpos_case) ) {
      options=options' +t';
   }
   if (def_maxbackup!='' && p_buf_size>=def_maxbackup) {
      options=options' +o';
   }
   return(options);
}

Sample VSLICK.ini line:
Code: [Select]
VSLICKSAVE=D:\Private\CryptVol +O H: +O
which disables backups for the 'D:\Private\Vol' subdir and whole drive H: (e.g. in a global backup dir somewhere else)

I needed this for a subdir-mounted crypted volume, where I don't want to get 'public' backups in my global backup dir ;)

Maybe it's worth to add this to the product.
BTW: Same method can be used in build_load_options().

HS2