Forums > Javascript

Request: folder creation from javascript

June 21, 2006 | 4:48 am

Is there some technical or philosophical reason why this is not possible or allowed? As for mechanism, a small extension to the File object might suffice, ie:

f = new File("Scratch:/testfolder", "readwrite", "fold");
if(f.isopen)
{
f.close;
}


June 21, 2006 | 3:37 pm

i 2nd that!
also worthwhile would be a "delete file" method. I recall this was discussed, perhaps in another context, some time ago (there was some fear of security or Max being the product of choice for malicious code writers or something), but it would be great! right now I’m using jit.qt.movie’s "kill" command, but of course that means one has to use jitter for this and is limited to files that jit.qt.movie can read!


June 21, 2006 | 11:01 pm

Quote: pnyboer wrote on Thu, 22 June 2006 03:37
—————————————————-
> there was some fear of security or Max being the product of
> choice for malicious code writers or something

Really? On OS X I can write highly malicious code in a few lines of AppleScript if I want to, though even then it’ll be limited to the current user’s permissions without requesting a password.

On Windows, Internet Explorer, Outlook Express and the command shell already constitute malicious code in my book. If I wanted an easy way to write malware, there’s VB (or whatever it’s called this year) and RealBasic just for starters.

Security for web- and mail-embedded JavaScript, sure, but that’s not the development environment’s problem – emasculating the programming tools isn’t the solution to OS security.

Sigh. I just want to check/create a preference folder structure at startup, without Java, and without 3rd-party objects.


June 21, 2006 | 11:14 pm

> emasculating the programming tools isn’t the solution to OS security.

i wasn’t defending it..just summarizing a past thread according to a
scanty memory :)

>
> Sigh. I just want to check/create a preference folder structure at
> startup, without Java, and without 3rd-party objects.

hear, hear!

p


June 22, 2006 | 12:17 am

>Sigh. I just want to check/create a preference folder structure at
>startup, without Java, and without 3rd-party objects.

Just curious John – why don’t you want to go the Java route?

Dan

Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X
http://www.defectiverecords.com

http://www.jackosx.com


June 22, 2006 | 1:34 am

Aside from not having great Java chops, and not being inclined to learn/read too much more to perform what are essentially very simple tasks, I’m also wary of Java version/library incompatibilities, and would prefer not to open up the possibility of that in a commercial app. I’ll use it if I MUST, but frankly once we’re talking about that sort of language I’d rather learn C/C++/ObjC than Java.

The things that attract me to JavaScript for Max is that it’s a fully interpreted language, completely self-contained, documentation is highly accessible, and it requires nothing other than Max to run.


June 22, 2006 | 4:32 am

Also, given Max annoyingly doesn’t understand the ~/ Unix path shorthand for the user’s home directory (hint: that’s a request), I’d like to be able to either

A – get the current user’s shortname, or

B – preferably, get the path to various system directories from the root, local, or user domains.

Because I’m vaguely concerned that the handy but unsupported "findfolder" object might never make it to Universal binary, then I’m screwed again.


June 22, 2006 | 9:03 am

Hi,

>
> Because I’m vaguely concerned that the handy but unsupported
> "findfolder" object might never make it to Universal binary, then
> I’m screwed again.
>

I am also concerned by this…
Philippe.


June 22, 2006 | 11:48 am

Not unreasonable – but I think that your worry about the Java version
stuff is mostly unfounded. I struggled with a very similar issue as
you recently, and decided to go the Java route for my task (where it
was trivial), and so far, so good…

Best,
Dan

At 1:34 PM +1200 6/22/06, John Pitcairn wrote:
>Aside from not having great Java chops, and not being inclined to
>learn/read too much more to perform what are essentially very simple
>tasks, I’m also wary of Java version/library incompatibilities, and
>would prefer not to open up the possibility of that in a commercial
>app. I’ll use it if I MUST, but frankly once we’re talking about
>that sort of language I’d rather learn C/C++/ObjC than Java.
>
>The things that attract me to JavaScript for Max is that it’s a
>fully interpreted language, completely self-contained, documentation
>is highly accessible, and it requires nothing other than Max to run.
>


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X
http://www.defectiverecords.com

http://www.jackosx.com


June 22, 2006 | 12:00 pm

I’d also love for a JS way to do these things, as I too fear the
findfolder object will not survive the transition to UB.

I’ve resorted to Java for these types of tasks, which so far has worked well.

Dan

At 4:32 PM +1200 6/22/06, John Pitcairn wrote:
>Also, given Max annoyingly doesn’t understand the ~/ Unix path
>shorthand for the user’s home directory (hint: that’s a request),
>I’d like to be able to either
>
>A – get the current user’s shortname, or
>
>B – preferably, get the path to various system directories from the
>root, local, or user domains.
>
>Because I’m vaguely concerned that the handy but unsupported
>"findfolder" object might never make it to Universal binary, then
>I’m screwed again.


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X
http://www.defectiverecords.com

http://www.jackosx.com


Viewing 10 posts - 1 through 10 (of 10 total)