--- a/Filename.st Thu Feb 09 10:07:19 2017 +0100
+++ b/Filename.st Thu Feb 09 18:18:24 2017 +0100
@@ -2043,6 +2043,23 @@
"Modified (comment): / 07-09-2011 / 12:20:59 / cg"
!
+asBackupFilename
+ "return the receiver converted to a backup filename."
+
+"/ ^ self species named:(nameString, '~').
+"/ ^ self species named:(self directoryName, '/~', self baseName).
+
+ ^ self addSuffix:'bak'
+
+ "
+ 'bla' asFilename asBackupFilename
+ '/home/user/directory/bla' asFilename asBackupFilename
+ 'directory/bla' asFilename asBackupFilename
+ "
+
+ "Created: / 09-02-2017 / 12:57:28 / stefan"
+!
+
asCanonicalizedFilename
"return the receiver converted to a filename without intermediate ..'s and .'s
(similar to an absolute pathname, but symlinks are not resolved)."
@@ -2064,6 +2081,27 @@
"Modified: 12.11.1996 / 12:40:03 / cg"
!
+asNonBackupFilename
+ "return the receiver converted to a backup filename."
+
+ nameString last == $~ ifTrue:[
+ ^ self class named:(nameString copyButLast:1).
+ ].
+ (self hasSuffix:'bak') ifTrue:[
+ ^ self withoutSuffix
+ ].
+ ^ self.
+
+ "
+ 'bla.bak' asFilename asNonBackupFilename
+ '/home/user/directory/bla.bak' asFilename asNonBackupFilename
+ 'directory/bla.bak' asFilename asNonBackupFilename
+ 'directory/bla~' asFilename asNonBackupFilename
+ "
+
+ "Created: / 09-02-2017 / 14:01:47 / stefan"
+!
+
asString
"return the receiver converted to a string"
@@ -5452,6 +5490,14 @@
"
!
+isBackupFilename
+ "return true, if this name is an for a backup file"
+
+ ^ nameString last == $~ or:[self hasSuffix:'bak'].
+
+ "Created: / 09-02-2017 / 13:57:03 / stefan"
+!
+
isExplicitRelative
"return true, if this name is an explicit relative name
(i.e. starts with './' or '../', to avoid path-prepending)"