Casper
DIV Pro
Posts: 31
Registered: 18-10-2017
Member Is Offline
|
|
Possible DIV3 bug? get_fileinfo appears not to work on Windows
This is my test program:
Code: |
COMPILER_OPTIONS _case_sensitive;
program test_get_fileinfo;
const
path = "assets\";
fileName = "test.dat";
global
fileHandle;
data = 777;
result1;
begin
fileHandle = fopen(path + fileName, "w");
fwrite(offset data, sizeof(data), fileHandle);
fclose(fileHandle);
result1 = get_fileinfo(path + fileName);
write_int(0, 20, 20, 0, &result1);
repeat
frame;
until (scan_code != 0)
end
|
The file is a simple DIV written file containing the integer value 273. When I run this program from DIV3, result1 is always 0.
[Edited on 2018-2-4 by Casper]
|
|
MikeDX
|
|
I believe this is indeed a bug since the windows version doesn't read the filesystem correctly. I will raise an issue on github and see if i can
address it this week
|
|
Casper
DIV Pro
Posts: 31
Registered: 18-10-2017
Member Is Offline
|
|
Thanks Mike!
I am actually struggling with a different related problem: I want to use get_dirinfo (which does work on windows) to retrieve a directory listing of
one of my asset data folders. However, it appears that get_dirinfo is always executed from the DIV executables path, not the path of the program. This
means I can't dynamically load data files from my game folder unless I predetermine the path in code (which won't be the same for users on another
machine).
Any tips? Is it possible in a DIV program to retrieve the value of what's in exec.path?
|
|
CicTec
DIV Pro
Posts: 471
Registered: 6-8-2016
Member Is Offline
|
|
Hi Casper,
GET_DIRINFO is one of the functions I have in the list to be implemented.
It simply does not work for windows because it uses search functions for UNIX and DOS, it is necessary to implement the version with the appropriate
WINDOWS functions to work well.
At the moment it will not work any way you try.
|
|
Casper
DIV Pro
Posts: 31
Registered: 18-10-2017
Member Is Offline
|
|
Hey CicTec,
That's interesting... because I do manage to get some information about the files in a directory using get_dirinfo()... perhaps Windows has a fallback
for old DOS commands?
|
|
CicTec
DIV Pro
Posts: 471
Registered: 6-8-2016
Member Is Offline
|
|
has some fallbacks probably, but to properly list the files and their names you need the native functions of the Windows API, especially to work
properly in the latest versions like Windows 8 and 10.
|
|