Opened 4 years ago
Closed 4 years ago
#123 closed defect (fixed)
lua on windows uses short file names
Reported by: | Owned by: | Thomas Bernard | |
---|---|---|---|
Priority: | major | Milestone: | 2.7 |
Component: | GrafX2 | Version: | 2.6 |
Keywords: | Cc: |
Description
Hi,
lua doesn't use long file names anymore only the short dos names. In grafx2-2.4.2035-win32 it was working maybe there is a clue what has changed.
Attachments (3)
Change History (14)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Milestone: | → 2.7 |
---|---|
Owner: | changed from | to
Status: | new → accepted |
What has changed is the added support for unicode filename.
https://gitlab.com/GrafX2/grafX2/merge_requests/31
up to version 2.5, windows version supported only "ANSI" file/directory names.
I guess you're script running with version 2.4 with non-ansi (greek, cyrillic, chinese, etc.) names would failed to run.
Please attach the affected script and the differences between runing it under 2.4 and 2.7wip.
by , 4 years ago
Attachment: | GFX2_G~1_8bit.raw.s added |
---|
by , 4 years ago
Attachment: | gfx2_gif_error_pic__8bit.raw.s added |
---|
by , 4 years ago
Attachment: | pic_db_Export_Pic2asm_8bit_Tiles_SP2D_GBA.lua added |
---|
comment:3 by , 4 years ago
the files are attached the one with the short name is the output of grafx2-2.7wip2729-issue_121.
edit:
the version I'm running that does it right is 2.5wip2171 with lua 5.3.3
comment:4 by , 4 years ago
the issue is that lua strings are 8bits strings.
getfilename() is returning the utf-8 filename under unix, but the "short" file name under Windows.
I think the good way to fix this is to return a UTF-8 conversion of the "Long" file name under Windows
(the long file name is stored as a unicode string)
follow-up: 8 comment:5 by , 4 years ago
anyway your code assume all characters of the filename except - %( %) +
are usable in ASM identifiers/labels, that is not true. you should filter out ALL characters except the authorized ones.
comment:6 by , 4 years ago
@HoraK-FDF@… are you OK with https://gitlab.com/GrafX2/grafX2/merge_requests/207 ???
(build to be available in https://gitlab.com/miniupnp/grafX2/-/jobs/220764906 )
comment:7 by , 4 years ago
By the way, lua io.open()
relies on fopen()
so it won't work correctly with unicode filenames. You should sanitize file names to ASCII before.
see https://gitlab.com/miniupnp/grafX2/-/jobs/220781780/artifacts/browse for build
comment:8 by , 4 years ago
Replying to Thomas Bernard:
anyway your code assume all characters of the filename except
- %( %) +
are usable in ASM identifiers/labels, that is not true. you should filter out ALL characters except the authorized ones.
that filtering I do by hand when naming the picture I don't use names with other characters than that I filter.
comment:9 by , 4 years ago
Thanks its seems to work at least with the characters I use in file names I tested it with all three versions.
I have a quick question I'm not sure if it is an bug or something that is like it is: every time I load a picture and don't change anything and only loaded to page 1 and let a script run (like the attached) when I then wan't to close gfx2 it comes with stay/save/discard dialog for booth pages, is that correct or must i run a special lua command in the script to avoid this? Or does gfx2 always assumes if a lua script has run something has changed?
comment:10 by , 4 years ago
yes GrafX2 make a backup even if the lua script doesn't change anything.
https://gitlab.com/GrafX2/grafX2/blob/master/src/factory.c#L2485
you can open a new ticket about it ;)
comment:11 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
sorry forgot I'm using grafx2-2.7wip2726-dir_fix as newest and tested down till v2.4 it was broken since one build of v2.5