Strange getFileList(directory) macro function behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange getFileList(directory) macro function behavior

John Oreopoulos
Hello,

I'd just like to report something I've noticed today in a macro I wrote to do some simple image processing. Early in my macro I call the function "getFileList(directory)" to generate a list (array format) of file names contained in a directory folder. I had written my macro such that the code further down assumed the file list would be imported alphabetically. What I found was that if I ran my macro pointing to a directory located in a remote sensor, the first file imported into the array was actually not the first alphabetical file name, and all the rest were sorted alphabetically thereafter. If I run the same code on the exact same directory copied locally to my computer instead, it works as I expected it to with proper alphabetical sorting.

Is this a bug?

I found I could get around this by calling the Array.sort(array) command immediately afterwards.


John Oreopoulos
Research Assistant
Spectral Applied Research
Richmond Hill, Ontario
Canada
www.spectral.ca
Reply | Threaded
Open this post in threaded view
|

Re: Strange getFileList(directory) macro function behavior

John Oreopoulos
Sorry, that should read "remote server".

John Oreopoulos

On 2012-05-07, at 6:44 PM, John Oreopoulos wrote:

> Hello,
>
> I'd just like to report something I've noticed today in a macro I wrote to do some simple image processing. Early in my macro I call the function "getFileList(directory)" to generate a list (array format) of file names contained in a directory folder. I had written my macro such that the code further down assumed the file list would be imported alphabetically. What I found was that if I ran my macro pointing to a directory located in a remote sensor, the first file imported into the array was actually not the first alphabetical file name, and all the rest were sorted alphabetically thereafter. If I run the same code on the exact same directory copied locally to my computer instead, it works as I expected it to with proper alphabetical sorting.
>
> Is this a bug?
>
> I found I could get around this by calling the Array.sort(array) command immediately afterwards.
>
>
> John Oreopoulos
> Research Assistant
> Spectral Applied Research
> Richmond Hill, Ontario
> Canada
> www.spectral.ca