This is an area that I think holds great latent promise.
Recent revs created c.backup. Here is the latest version:
def backup(self,fileName=None,useTimeStamp=True):
'''
Back up given fileName or c.fileName().
If useTimeStamp is True, append
year-month-day-hour-minute to the filename.
'''
c = self
fn = fileName or c.fileName()
if not fn:
return
theDir,base = g.os_path_split(fn)
if useTimeStamp:
if base.endswith('.leo'):
base = base[:-4]
stamp = time.strftime("%Y%m%d-%H%M%S")
fn = '%s-%s.leo' % (base,stamp)
path = g.os_path_finalize_join(theDir,fn)
else:
path = fn
# Save the file.
if fn:
c.saveTo(fileName=fn)
g.es('in',theDir)
# Issues saved message.
I have used c.backup to create local backups of personal files that are not
tracked by git. These files are in my home directory. I want the backups
to go in the 'Backups' subdirectory. Here is the body of the @button
backup node:
theDir,base = g.os_path_split(c.fileName())
path = g.os_path_join(theDir,'Backup',base)
c.backup(fileName=path,useTimeStamp=True)
This kind of button is only the tip of a large iceberg.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.