This seems strange, when I run the command:
ExternalWindowsOSProcess command: 'del "C:\MediaVault\BBC\test.txt"' I get an error, with or without double quotes around the file name. It is strange because I use it three times in my method. The first two invocations launch external programs with long command strings. They work fine, but when I want to clean up, the process fails. The test case above, executed from Workspace, fails consistently. It fails in 5.2/64 and 5.2.32 I have not tried it in older versions ------- Image ----- C:\Smalltalk\Squeak5.2alpha-18110-64bit-201804030952-Windows\Squeak5.2alpha-18110-64bit\Squeak5.2alpha-18110-64bit.1.image Squeak5.2alpha latest update: #18110 Current Change Set: BBCRR-RestartAt5.2alpha Image format 68021 (64 bit) ----- -jrm _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Well here I am replying to my own post. I don't have a solution to the problem I reported, but I did find an alternative solution. I used method finder to find methods with the #String 'delete' in them. The class #OSProcess contains a method #deleteFileNamed: which was just what I needed. Provide a fully qualified file name as the argument and it gets deleted. e.g. "OSProcess deleteFileNamed: 'C:\MediaVault\BBC\test.txt'" I developed and tested this on 5.2-64 on Windows. 7 -jrm On Tue, Jun 26, 2018 at 3:38 PM John-Reed Maffeo <[hidden email]> wrote:
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
The original problem you saw is probably due to deficiencies in OSProcess
on Windows (the Windows support is incomplete and not very useful overall). But let me add a explanation to the solution that you found. In Squeak you can delete the file like this: FileDirectory default deleteFileNamed: 'C:\MediaVault\BBC\test.txt' The OSProcess version of this is a compatibility method that I wrote in order to allow OSProcess to work on Cuis and Pharo in addition to Squeak (I develop it in Squeak of course). For example, some of the unit tests for OSProcess and CommandShell need to create temporary test files and delete them. I can use "OSProcess deleteFileNamed:" instead of "FileDirectory default deleteFileNamed:" to do this, and that allows the unit tests to run on Squeak, Cuis, and Pharo. For your own case, I would recommend just using the FileDirectory method, because that is the simplest solution. HTH, Dave On Tue, Jun 26, 2018 at 07:06:17PM -0700, John-Reed Maffeo wrote: > Well here I am replying to my own post. I don't have a solution to the > problem I reported, but I did find an alternative solution. > > I used method finder to find methods with the #String 'delete' in them. The > class #OSProcess contains a method #deleteFileNamed: which was just what > I needed. Provide a fully qualified file name as the argument and it gets > deleted. e.g. "OSProcess deleteFileNamed: 'C:\MediaVault\BBC\test.txt'" > > I developed and tested this on 5.2-64 on Windows. 7 > > -jrm > > > > On Tue, Jun 26, 2018 at 3:38 PM John-Reed Maffeo <[hidden email]> wrote: > > > This seems strange, when I run the command: > > ExternalWindowsOSProcess command: 'del "C:\MediaVault\BBC\test.txt"' > > > > I get an error, with or without double quotes around the file name. > > > > It is strange because I use it three times in my method. The first two > > invocations launch external programs with long command strings. They work > > fine, but when I want to clean up, the process fails. The test case above, > > executed from Workspace, fails consistently. > > > > It fails in 5.2/64 and 5.2.32 > > > > I have not tried it in older versions > > > > ------- > > Image > > ----- > > > > C:\Smalltalk\Squeak5.2alpha-18110-64bit-201804030952-Windows\Squeak5.2alpha-18110-64bit\Squeak5.2alpha-18110-64bit.1.image > > Squeak5.2alpha > > latest update: #18110 > > Current Change Set: BBCRR-RestartAt5.2alpha > > Image format 68021 (64 bit) > > ----- > > > > -jrm > > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |