#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sun, 15 Apr 2018 07:04:58 +0200
changeset 22676 69e0924c2205
parent 22675 92533fa8cce5
child 22677 71fe98c612e2
#FEATURE by cg class: Filename class added: #downloadsDirectory
Filename.st
--- a/Filename.st	Sat Apr 14 08:07:03 2018 +0200
+++ b/Filename.st	Sun Apr 15 07:04:58 2018 +0200
@@ -419,6 +419,34 @@
     "Created: / 16-05-2007 / 13:18:34 / cg"
 !
 
+downloadsDirectory
+    "return the downloads directory.
+     Some OperatingSystems do not support this - on those, 
+     the documentsDirectory is returned.
+     Notice: services under windows do not have a user/home and therefore
+     no downloads directory."
+
+    |home dir|
+
+    home := self homeDirectory.
+    home isNil ifTrue:[^ nil].
+    #(
+        'Downloads'
+        'downloads'
+        'Download'
+        'download'
+    ) do:[:eachTry |
+        (dir := home / eachTry) exists ifTrue:[
+            ^ dir
+        ].
+    ].
+    ^ nil
+
+    "
+     Filename downloadsDirectory
+    "
+!
+
 findDefaultDirectory
     "same as #defaultDirectory for ST80 compatibility"