Skip to content
Permalink
Browse files

FileAttributesPlugin: Fix DiskStore>>isSymlink (was still using FileP…

…lugin), Remove platform hack in File class>>isSymlink:
  • Loading branch information...
akgrant committed Aug 25, 2018
1 parent 89b0404 commit 3f7faf3f99fca6ee8c689eda3357996203ad403c
Showing with 23 additions and 29 deletions.
  1. +3 −17 src/FileSystem-Disk/DiskStore.class.st
  2. +8 −0 src/FileSystem-Disk/WindowsStore.class.st
  3. +12 −12 src/Files/File.class.st
@@ -172,13 +172,6 @@ DiskStore >> basicIsFile: anEntry [
^ (anEntry at: 4) not
]

{ #category : #private }
DiskStore >> basicIsSymlink: anEntry [
^(anEntry size >= 7)
ifTrue: [ anEntry at: 7 ]
ifFalse: [ false ]
]

{ #category : #private }
DiskStore >> basicModificationTimeOf: anEntry [
" the entry contains the seconds since the squeak epoch in local time"
@@ -411,16 +404,9 @@ DiskStore >> isSocket: aPath [

{ #category : #public }
DiskStore >> isSymlink: aPath [
| entry |

aPath isRoot ifTrue: [ ^false ].

entry := self basicEntryAt: aPath.

^ entry == #badDirectoryPath
ifTrue: [ false ]
ifFalse: [ self basicIsSymlink: entry ].

"Answer a boolean indicating whether aPath is a symbolic link"

^File isSymlink: (self stringFromPath: aPath)
]

{ #category : #testing }
@@ -58,6 +58,14 @@ WindowsStore >> currentDisk [
^ disk ifNil: [ disk := FileSystem workingDirectory path segments first ]
]

{ #category : #public }
WindowsStore >> isSymlink: aPath [
"Answer a boolean indicating whether aPath is a symbolic link.
Answer false as symbolic links aren't supported on Windows."

^false
]

{ #category : #private }
WindowsStore >> nodesAt: aPath do: aBlock [

@@ -406,7 +406,7 @@ File class >> isSymlink: aPath [
"Answer a boolean indicating whether the supplied path is a Symlink file.
Note that this should only be called on platforms that support symlinks (e.g. not Windows)"

^self supportsSymbolicLinks and: [ self fileAttribute: aPath number: 16 ]
^self fileAttribute: aPath number: 16
]

{ #category : #'primitives-file modes' }
@@ -916,6 +916,17 @@ File class >> stdioHandles [
self primitiveFailed
]

{ #category : #'primitives-file' }
File class >> stdioIsAvailable [
"Answer a boolean indicating whether stdio is available on the current platform.
stdio is considered available if any one of the three files (stdin, stdout, stderr) is available."

^ (0 to: 2)
anySatisfy: [ :fdNum | | res |
res := self fileDescriptorType: fdNum.
res between: 1 and: 3 ]
]

{ #category : #'primitives-errors' }
File class >> stringTooLong [
"String too long. A file path name was longer than PATH_MAX"
@@ -929,17 +940,6 @@ File class >> supportsSymbolicLinks [
^OSPlatform current isUnix
]

{ #category : #'primitives-file' }
File class >> stdioIsAvailable [
"Answer a boolean indicating whether stdio is available on the current platform.
stdio is considered available if any one of the three files (stdin, stdout, stderr) is available."

^ (0 to: 2)
anySatisfy: [ :fdNum | | res |
res := self fileDescriptorType: fdNum.
res between: 1 and: 3 ]
]

{ #category : #'primitives-file' }
File class >> sync: id [
"On Unix, this syncs any written or flushed data still in the kernel file

0 comments on commit 3f7faf3

Please sign in to comment.
You can’t perform that action at this time.