--- a/Filename.st Tue Jan 22 14:45:56 2019 +0100
+++ b/Filename.st Tue Jan 22 14:51:37 2019 +0100
@@ -4358,6 +4358,80 @@
"Modified: / 16-08-2009 / 13:27:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
+!Filename methodsFor:'inspecting'!
+
+inspector2TabContentsView
+ <inspector2Tab>
+
+ "provide an additional tab, which presents the file's contents.
+ '.' asFilename inspect
+ 'smalltalk.rc' asFilename inspect
+ "
+
+ | mimetype |
+
+ self isDirectory ifTrue:[
+ | tab |
+
+ ^ (tab := Tools::Inspector2Tab new)
+ label: 'Contents';
+ priority: 50;
+ applicationHolder: [
+ | browser |
+
+ browser := DirectoryContentsBrowser new.
+ browser
+ initializeAspects;
+ aspectFor:#currentFileNameHolder put:((OrderedCollection with:self) asValue);
+ updateCurrentFileNameHolderWhenSelectionChanges:false.
+ browser viewDirsInContentsBrowser value:true.
+ browser enterActionBlock:[:item|
+ | app |
+ app := tab view topView application.
+ app notNil ifTrue:[
+ app inspect: item fileName.
+ ].
+ ].
+ browser
+ ];
+ yourself
+ ].
+ mimetype := self mimeTypeFromName.
+ (mimetype notNil and:[mimetype isTextType or:[ mimetype endsWith: '-source']]) ifTrue:[
+ ^ Tools::Inspector2Tab new
+ label: 'Contents';
+ priority: 50;
+ view: [
+ | view model |
+
+ self exists ifTrue:[
+ model := self contents asValue.
+ ] ifFalse:[
+ model := 'File does not (no longer?) exist' asValue.
+ ].
+ view := Tools::CodeView2 new.
+ view model: model.
+ view acceptAction:[ :contents |
+ self writingFileDo:[:s|
+ contents do:[:line | s nextPutLine: line ].
+ ].
+ model value: contents.
+ ].
+ view
+ ];
+ yourself
+ ].
+
+ ^ nil
+
+ "
+ '/tmp' asFilename inspect
+ "
+
+ "Created: / 13-02-2015 / 15:08:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-02-2015 / 20:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 14-09-2018 / 18:27:06 / Claus Gittinger"
+! !
!Filename methodsFor:'instance creation'!
@@ -5852,7 +5926,7 @@
no compression will be done (for now; this may change).
See also: name"
- ^ OperatingSystem pathNameOf:(self osName).
+ ^ OperatingSystem pathNameOf:(self osNameForFile).
"
'/foo/bar' asFilename pathName
@@ -5866,7 +5940,7 @@
"
"Modified: / 27-04-1996 / 18:19:52 / cg"
- "Modified: / 21-01-2019 / 16:19:33 / Stefan Vogel"
+ "Modified: / 22-01-2019 / 14:49:43 / Stefan Vogel"
!
pathNameRelativeFrom:anotherDirectoriesFilename