--- a/JavaVM.st Thu Dec 03 13:09:37 1998 +0000
+++ b/JavaVM.st Thu Dec 03 14:23:18 1998 +0000
@@ -1876,13 +1876,13 @@
defaultJWSHome
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[
- ^ 'phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS'
+ ^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS'
].
^ '/usr/local/java/JWS'.
"Created: / 3.1.1998 / 14:27:42 / cg"
- "Modified: / 2.12.1998 / 23:10:08 / cg"
+ "Modified: / 3.12.1998 / 14:54:08 / cg"
!
defaultWindowingToolKit
@@ -2666,6 +2666,36 @@
"Modified: / 4.2.1998 / 19:38:26 / cg"
!
+checkWritePermissionOfDirectory:dir message:msg
+ |answer|
+
+ (PermittedDirectories notNil
+ and:[PermittedDirectories includes:dir]) ifFalse:[
+ FileOpenConfirmation ifTrue:[
+ answer := Dialog
+ confirmWithCancel:msg withCRs
+ labels:#('no' 'grant')
+ values:#(false true)
+ default:2.
+ answer == false ifTrue:[
+ ^ false
+ ].
+
+ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs)
+ ifTrue:[
+ PermittedDirectories isNil ifTrue:[
+ PermittedDirectories := Set new
+ ].
+ PermittedDirectories add:dir.
+ ]
+ ]
+ ].
+ ^ true
+
+ "Created: / 3.12.1998 / 15:07:56 / cg"
+ "Modified: / 3.12.1998 / 15:16:55 / cg"
+!
+
commonOpen:nativeContext forAppend:forAppend
|fs fd fn name dir stream fileNo answer readonly|
@@ -2949,7 +2979,7 @@
stream := self fileStreamForReading:name.
stream isNil ifTrue:[
FileOpenTrace ifTrue:[
- ('JAVA: failed to open ' , name , ' for reading.') infoPrintCR.
+ ('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR.
].
self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading').
@@ -2975,7 +3005,7 @@
fd instVarNamed:'fd' put:fileNo.
"Created: / 4.1.1998 / 16:47:12 / cg"
- "Modified: / 21.10.1998 / 01:40:00 / cg"
+ "Modified: / 3.12.1998 / 15:13:51 / cg"
!
_FileInputStream_read:nativeContext
@@ -3268,11 +3298,44 @@
!
_File_renameTo0:nativeContext
- "/ boolean renameTo0 (java.io.File)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:03:28 / cg"
+ "/ void renameTo0 (java.io.File)
+
+ |oldFile newFile oldPath newPath oldF newF|
+
+ oldFile := nativeContext receiver.
+ oldPath := oldFile instVarNamed:'path'.
+ oldPath notNil ifTrue:[
+ oldPath := Java as_ST_String:oldPath.
+
+ newFile := nativeContext argAt:1.
+ newPath := newFile instVarNamed:'path'.
+ newPath notNil ifTrue:[
+ newPath := Java as_ST_String:newPath.
+
+ oldF := oldPath asFilename.
+ newF := newPath asFilename.
+
+ (self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?'))
+ ifFalse:[
+ ^ 0 "/ FALSE
+ ].
+ oldF directory pathName ~= newF directory pathName ifTrue:[
+ (self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?'))
+ ifFalse:[
+ ^ 0 "/ FALSE
+ ].
+ ].
+
+ OperatingSystem accessDeniedErrorSignal handle:[:ex |
+ ^ 0 "/ FALSE
+ ] do:[
+ oldF renameTo:newF.
+ ]
+ ]
+ ].
+ ^ 1 "/ TRUE
+
+ "Modified: / 3.12.1998 / 15:22:43 / cg"
!
_File_rmdir0:nativeContext
@@ -8624,15 +8687,19 @@
!
_WLabelPeer_setText:nativeContext
- |label jString|
+ |label jString str|
jString := nativeContext argAt:1.
label := self viewForWPeer:nativeContext.
- label label:(Java as_ST_String:jString)
+ str := jString.
+ str notNil ifTrue:[
+ str := Java as_ST_String:str
+ ].
+ label label:str
"Created: / 7.1.1998 / 21:43:51 / cg"
- "Modified: / 8.1.1998 / 17:35:50 / cg"
+ "Modified: / 3.12.1998 / 14:59:18 / cg"
!
_WListPeer__addItem:nativeContext
@@ -10487,6 +10554,6 @@
!JavaVM class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.87 1998/12/03 13:08:46 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.88 1998/12/03 14:23:18 cg Exp $'
! !
JavaVM initialize!