Domanda

Given the following code:

file-info: info? %my_file.txt

How do you compare file-info/type in a conditional like:

if file-info/type = "directory" [ ... ]
È stato utile?

Soluzione

You can do this all in one line

if 'file = get in file-info: info? %my-file 'type [
   ... is file ...
]

Altri suggerimenti

In R2, You may want to try:

>> dir? %my_file.txt
== false

If R3, I wouldn't suggest that because it checks if a file ends with a slash.

I'm not sure what you are trying to do, but it seems a little overcomplicated.

if file-info/type = 'directory [ ... ]

(Never underestimate your ability to realize the answer to your own question within 30 seconds of asking it.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top