Author Topic: _FindFirstFile strange behaviour  (Read 25822 times)

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 542
  • Old Skull
    • View Profile
_FindFirstFile strange behaviour
« on: May 14, 2012, 13:53:32 »
I have the following code:

Code: [Select]
$s = AskText("Enter file name", "New file.txt", 0);
Log(0, 10, GetSourcePath() + $s);
Log(0, 10, _findfirstfile(GetSourcePath() + $s));

When i pass exact file name fo _FindFirstFile function, it finds nothing. But when i pass file mask, it finds that file:

Code: [Select]
012-05-14 15:46:21.192 D:\1\New file 1.txt
2012-05-14 15:46:21.192 Script engine - _FindFirstFile : 'D:\1\' - 'New file 1.txt'
2012-05-14 15:46:21.192 Script engine - _FindFirstFile found nothing
2012-05-14 15:46:21.192
2012-05-14 15:46:32.052 D:\1\*.txt
2012-05-14 15:46:32.052 Script engine - _FindFirstFile : 'D:\1\' - '*.txt'
2012-05-14 15:46:32.052 Script engine - Match found _FindFirstFile found : 'D:\1\New file 1.txt'
2012-05-14 15:46:32.052 D:\1\New file 1.txt

Is it a bug?

--

P.S. Where can i find list of the internal commands like _FindFirstFile? I haven't found it in online documentation. Maybe i've overlooked?
« Last Edit: May 14, 2012, 13:57:44 by Jungle »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4424
    • View Profile
    • Multi Commander
Re: _FindFirstFile strange behaviour
« Reply #1 on: May 14, 2012, 14:50:07 »
_findfirstfile match by using a wildcard filter. So when using exact name it fails so it is a bug.

Anohter The "Problem" with _FindFirstFile is that it only support local file system. I was planing to add so that used the virtual filesystem layer in MC. So that all file systems that is supported in MC could be used.. Like Ftp, Zip, and so on. But I never got the time.

Thats wait it also is missing from the online doc. But I will add it to the documentation. and fix the pattern matching issue.

I have a couple of script issue Im planing on fixing soon, So if there is any script functions you are missing let me know.

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 542
  • Old Skull
    • View Profile
Re: _FindFirstFile strange behaviour
« Reply #2 on: May 14, 2012, 15:03:22 »
So if there is any script functions you are missing let me know.

I have not tried yet, but i wonder wheter it is possible to use do...while loop.

Code: [Select]
do {
  ...
} while ( ... );

Online doc only has example of while loop.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4424
    • View Profile
    • Multi Commander
Re: _FindFirstFile strange behaviour
« Reply #3 on: May 14, 2012, 15:49:52 »
I have not tried yet, but i wonder wheter it is possible to use do...while loop.
No Do-While is not supported. And I kind of skipped that because it is not necessary, You can do most thing with the for and while loops. But it would be nice to have. But adding new core function like Do-While to the script engine is time consuming because it is so easy to break the code and it also require so must testing.
I do have a lot of automated tests for the script engine but even so cost of time is to great at the moment There are a lot of other features that are more importent.

However adding library functions (like _FindFirstFile, and other function that are not part of the core language) to the script language is cheap.




Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 542
  • Old Skull
    • View Profile
Re: _FindFirstFile strange behaviour
« Reply #4 on: May 14, 2012, 15:56:40 »
However adding library functions (like _FindFirstFile, and other function that are not part of the core language) to the script language is cheap.

Thanks, will keep it in mind.