Opened 3 years ago

Closed 11 months ago

#45 closed enhancement (fixed)

relative paths should allways start from same point

Reported by: HoraK-FDF Owned by: Thomas Bernard
Priority: major Milestone: 2.7
Component: GrafX2 Version: 2.5
Keywords: Cc:

Description

This is what i wrote on the old google code page because i don't know if the issues there are maintained anymore:

grafx2 - issue #553

Hi,

i was trying to make an portable grafx2 for my sd-card but i encountered some problems: If i enter an relative path in the ini for an bookmark the program can only use this link once or i must go back to the grafx2 directory that it works again, if i click on the bookmark twice or on an other relative bookmark the screen flashes red because he tryes to open the relative path where it is, not relative from grafx2 dir. It would be nice if all relative path calls start from the grafx2 dir and an option for the right-click bookmarks set menu that sets an relative path. under windows it needs to do that only if the bookmark directory is on the same drive.

... greetings HoraK-FDF

That was it from the old page now i tested again and here what now works and what not
lets say grafx2 is in c:\tools\grafx2 and i want make a relative path to c:\destdir then i wrote ..\..\destdir in the ini now it is possible to get to that directory from any depth <= in this case two times ..
c: works
c:\depth1 works
c:\depth1\depht2 works
c:\depth1\depht2\depth3 don't work
any other drive like d: don't work

Attachments (2)

gx2_rel_mod_small.png (1.0 KB) - added by HoraK-FDF 3 years ago.
gfx2-load_save_sfn-01.png (4.7 KB) - added by HoraK-FDF@… 11 months ago.

Download all attachments as: .zip

Change History (56)

Changed 3 years ago by HoraK-FDF

Attachment: gx2_rel_mod_small.png added

comment:1 Changed 3 years ago by HoraK-FDF

I have added a little pic how it might look like what i meant with the line:

an option for the right-click bookmarks set menu that sets an relative path. under windows it needs to do that only if the bookmark directory is on the same drive

Last edited 3 years ago by HoraK-FDF (previous) (diff)

comment:2 Changed 2 years ago by Thomas Bernard

Owner: changed from pulkomandy to Thomas Bernard
Status: newaccepted

that should not be difficult to implement

comment:3 Changed 2 years ago by PulkoMandy

We like to play with chdir a lot in GrafX2, so one cannot rely on the "current directory".

Additionally, there are quirks depending on the platform:

  • Standard UNIX stores some files in share/ and home/.config
  • Windows stores in Program Files and user data
  • GP2X and friends (and probably Android) stores things on external SD card and not home, which is in internal flash and should not be written to
  • Haiku has the program starting with current dir in "home", not in the executable directory
  • ... probably some more

We do have a realpath implementation, but one has to take care of being in the correct dir when using it with relative paths.

comment:4 Changed 2 years ago by Thomas Bernard

I may have misunderstood the ticket description, but I don't think it is about path relatives to "current directory", but path relative to binary location path.
GrafX2.EXE in c:\tools\grafx2 => then ../../destdir would be C:\destdir whatever the current directory is !

comment:5 Changed 2 years ago by PulkoMandy

Yes, what I mean is it may be hard to find "c:\tools\" in that case because the "current directory" is changed quite often and I'm not sure we store the "executable path" anywhere.

comment:6 Changed 2 years ago by Thomas Bernard

Data_directory is set to the path of the exe + "../share/grafx2/"
We could also expose as global the Program_directory which is found in Init_program()

comment:8 Changed 2 years ago by Thomas Bernard

I think it is OK : https://gitlab.com/GrafX2/grafX2/merge_requests/52

The feature is not available for OS which don't handle ../ or ./ (Amiga OS and friends)

comment:9 Changed 2 years ago by Thomas Bernard

@HoraK-FDF : are you able to test ?
Here is the build : https://gitlab.com/miniupnp/grafX2/-/jobs/61157930/artifacts/download

comment:10 Changed 2 years ago by PulkoMandy

Mh... do we want to expose it this way to the user? I can understand the need for proper behavior from the INI file when creating a "portable" workspace, but it seems a bit annoying to have a separate button for this.

We could either always store relative paths (this is ok as long as you don't move the grafx2 install around, I guess); continue to store absolute paths by default and allow relative ones; or maybe find some smarter way to decide when to use a relative path?

comment:11 Changed 2 years ago by Thomas Bernard

Well that is how the need is exposed in the ticket... I just implemented according to what HoraK-FDF asked. I hope he can test and give his feedback.

Under windows or TOS (Mint) we could set relative path if on same drive, and absolute on other drive.
with other OS it is a bit more complex

comment:12 Changed 2 years ago by Thomas Bernard

comment:13 Changed 2 years ago by Thomas Bernard

@PulkoMandy? : so what about my proposition to remove the specific "Set Rel" option and make relatives path if on the same drive ?
under windows we could just check the drive letter
under Unix systems the st_dev of the stat() structure should be the same.
@HoraK-FDF : does that fullfill your needs ?

comment:14 Changed 2 years ago by PulkoMandy

If i enter an relative path in the ini for an bookmark the program can only use this link once or i must go back to the grafx2 directory that it works again, if i click on the bookmark twice or on an other relative bookmark the screen flashes red because he tryes to open the relative path where it is, not relative from grafx2 dir.

I would start with this (handle relative paths in the ini file properly - make them relative to the grafx2 executable location). I think it is not needed to have it visible in the UI. Using relative paths when on the same drive may seem nice, but if you move the grafx2 executable from one place to another, or just use different versions of grafx2 on the same computer (common use case for me as a dev), it will result in broken bookmarks.

Let's keep this as a "poweruser" feature for now, for people who edit the .ini file. And let's see about how to best integrate it in the UI later.

comment:15 Changed 2 years ago by Thomas Bernard

The 1st part of the feature (allowing path relative to "program directory" in ini file) is my commit from 3 month ago (now rebased) :
https://gitlab.com/GrafX2/grafX2/merge_requests/52/diffs?commit_id=165e92fcd101cd063e72f6912659ca46e3c4f9f0

The second part is about being able to set such bookmarks. I personally think it is better to add the "Set Rel" option. "Powerusers" would be able to control what they do, and average users will probably never mess things up, because they won't move the grafx2 executable anyway ;)

If you use different versions of grafx2 on the same computer, it makes you into the "poweruser" category and you should know what you do when setting bookmarks ;)

As you seems reluctant about the HoraK-FDF proposal of the "Set Rel" option, I proposed to auto-detect relative/absolute but I don't favor that.

So what do you want to do ?
1) Absolute/relative path autodetect
2) "Set Rel" option.
3) Close this ticket as "won't-fix" (won't enhance in fact;)

comment:16 Changed 2 years ago by PulkoMandy

I think what was meant in the original ticket was a global option (in the settings screen). This would be less confusing than having "set" and "set rel" directly in the bookmark menu, which is already not one of the most intuitive parts of our UI.

comment:17 Changed 2 years ago by Thomas Bernard

I think we don't have the same understanding of the original ticket :)

 an option for the right-click bookmarks set menu that sets an relative path.

HoraK-FDF even added a picture to be more explicit :
http://pulkomandy.tk/projects/GrafX2/raw-attachment/ticket/45/gx2_rel_mod_small.png

comment:18 Changed 2 years ago by PulkoMandy

Milestone: 2.52.6

comment:19 Changed 15 months ago by PulkoMandy

Milestone: 2.62.7

Move open tickets to 2.7 milestone

comment:20 Changed 14 months ago by HoraK-FDF@…

Hello everyone,

sorry that i was so long away and thanks for all the work.
Maybe it would be good to add an ini-file entry like Portable_install=0/1 and if the directory to bookmark is on the same drive automatically a relative path is stored. I also tested your artifact but it always stored an absolute path and it also altered the ini of the installed grafx2, maybe grafx2 should not use the Windows User Data directory and store the config always in ..\share\grafx2 (a Portable_install ini-file-entry would be useless without this behavior) or always check first if ..\share\grafx2\gfx2.ini exist if yes use it if not use windows/linux user directory. The relative path should be start from the location of binary i think. I'm talking from the Windows side now I have not used portable linux apps at the moment.
Here is an example how i wanted to use it:
First the reason:
Since I come around many Windows PCs I thought to be able to draw everywhere when nothing else is to do I put grafx2 on a sdcard as a portable app.

But different PCs have different drives/partitions on one my grafx2 sdcard directory will be on E:\grafx2\bin on another it's I:\grafx2\bin so i need relative paths to access the pictures on the sdcard, the pictures I draw are always on the same sdcard as the portable grafx2 so it must only save paths on the same drive as relative paths all other paths ouside the portable grafx2 drive should be stored as absolute paths (at least on Windows its also impossible to do a cd ..\..\D:\picturedir). Now it would be possible to always set the path to the relative directory by editing the ini, but I think its better to let it do grafx2 automatically depending on Portable_install=0/1 or if there is no Portable_install ini-file-entry to use "Set Rel", why "switch out of gx2->navigate to ini dir->edit->switch back to gx2" when its possible to do this quickly from within grafx2. It is also possible on some PCs like those from a seminar or so that access is limited for the normal user and you don't have the permission to use the editor then you are screwed on those PCs, that would be another point for a "grafx2 can do it alone"-solution.

... greetings HoraK-FDF

comment:21 Changed 14 months ago by Thomas Bernard

@HoraK-FDF : I just rebased my branch.
can you check if that work as you intended ?

you will be able to download from job artifacts :
https://gitlab.com/miniupnp/grafX2/-/jobs/154314820
when it is finished.

comment:22 Changed 14 months ago by Thomas Bernard

I just test 2.6.2529-issue45 (but under FreeBSD) and Set rel does store relative path in gfx2.ini Bookmark

comment:23 Changed 14 months ago by HoraK-FDF@…

I tested all
first is "Set" on grafx2 bin dir
second is "Set Rel" on grafx2 bin dir
third is "Set" on some dir
forth is "Set Rel" on some dir

grafx2-sdl-2.6.2529-issue45-sdl creates:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\artifacts3\grafx2-sdl-2.6.2529-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\bin

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\..\#dwn

grafx2-sdl-2.6.2529-issue45-sdl2 creates:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\artifacts3\grafx2-sdl2-2.6.2529-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\bin

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\..\#dwn

grafx2-sdl-2.6.2529-issue45-win32 creates:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\artifacts3\grafx2-win32-2.6.2529-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\..\..\artifacts3\grafx2-win32-2.6.2529-issue45-win32\bin

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\..\#dwn

So the depth is one to deep and for the bookmarked bin dir its totally wrong.
There are also two other things that not work:
First it always uses the config in the Windows User directory and if there is no config there it creates it there which will make a portable version impossible.
Second "Set Rel" only works if you browse there if you use a bookmark and browse from there or use change drive and go back on the drive of the grafx2 install and browse from there it will will only store an absolute path:

Bookmark_label = #dwn
Bookmark_directory = F:\#dwn

the drive letter then is also uppercase.

If "Set Rel" used on a drive other then the one where the portable grafx2 is it does nothing that good but maybe its nice there to don't even bring up the "Set Rel" option in this case or let grafx2 flash red.

comment:24 Changed 14 months ago by Thomas Bernard

For a real "portable" installation,
you have to make sure gfx2.cfg is located in the main Grafx2 directory (upper directory of "bin" which must contains the .exe file)

For example you should have
F:\GrafX2-2.6.2529\gfx2-win32.cfg
F:\GrafX2-2.6.2529\bin\grafx2-win32.exe
etc.

There is indeed a problem in the calculation of the relative directories under windows. I'll have to check that.

comment:26 Changed 14 months ago by Thomas Bernard

@pulkomandy: What if I detect at startup if we are a "portable installation" (ie the .cfg file is loaded from program directory) and enable the "Set Rel" option only in that case ?
It is right that "Set Rel" is absolutely useless for a "fixed" installation.

comment:27 Changed 14 months ago by PulkoMandy

Yes, sounds fine

comment:28 Changed 14 months ago by HoraK-FDF@…

grafx2-sdl-2.6.2530-issue45-win32 makes:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl-2.6.2530-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2-à
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl-2.6.2530-issue45-win32

Bookmark_label = grafx2-à
Bookmark_directory = ..\..\..\grafx2-sdl-2.6.2530-issue45-win32

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\grafx2

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\#dwn

grafx2-sdl2-2.6.2530-issue45-win32 makes:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl2-2.6.2530-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2-à
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl2-2.6.2530-issue45-win32

Bookmark_label = grafx2-à
Bookmark_directory = ..\..\..\grafx2-sdl2-2.6.2530-issue45-win32

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\grafx2

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\#dwn

grafx2-win32-2.6.2530-issue45-win32 makes:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\grafx2-win32-2.6.2530-issue45-win32\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\grafx2-win32-2.6.2530-issue45-win32\bin

Bookmark_label = grafx2-à
Bookmark_directory = f:\#dwn\grafx2\grafx2-win32-2.6.2530-issue45-win32

Bookmark_label = grafx2-à
Bookmark_directory = ..\..\..\grafx2-win32-2.6.2530-issue45-win32

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\grafx2

Bookmark_label =#dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\#dwn

it's still one .. too much and Set Rel on bin dir should give . but ..\bin is also correct and the win32-api version does it even more wrong with the bin dir.

And in case of an path that lies strait downwards like
..\..\..\..\#dwn only ..\..\.. would be needed.

that is also true for path that lie up of bin dir:

Bookmark_label = one_up
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl-2.6.2530-issue45-win32\bin\one_up

Bookmark_label = one_up
Bookmark_directory = ..\..\bin\one_up

Bookmark_label = one_up
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl2-2.6.2530-issue45-win32\bin\one_up

Bookmark_label = one_up
Bookmark_directory = ..\..\bin\one_up

Bookmark_label = one_up
Bookmark_directory = f:\#dwn\grafx2\grafx2-win32-2.6.2530-issue45-win32\bin\one_up

Bookmark_label = one_up
Bookmark_directory = ..\..\..\grafx2-win32-2.6.2530-issue45-win32\bin\one_up

in that cast i don't know if a one_up is enough or if .\one_up is needed.

Also the bug described in comment 23 after using select drive or a bookmark is still there.
first Set

Bookmark_label = #dwn
Bookmark_directory = F:\#dwn

second Set Rel

Bookmark_label = #dwn
Bookmark_directory = F:\#dwn

and what do you think about the last sentence of comment 23? Is this easy to implement or is hiding the Set Rel in that case to much programming work?

I asked this in issue 100 but especially for the portable version that would make much sense, can you please add the windows zip versions nightly builds to http://grafx2.gitlab.io/grafX2/ ?

comment:29 Changed 14 months ago by Thomas Bernard

1) ..\..\bin is ok as the reference path is the Data directory (share/grafx2)

2) I'm currently implementing the disabling of set rel when not in "Portable installation" mode

3) see https://miniupnp.gitlab.io/grafX2/

I have spotted an issue with drive letter case.

comment:30 Changed 14 months ago by HoraK-FDF@…

ok in one comment it was talked about the binary location and grafx2 always starts in the bin dir so i thought that would be the start point. Then its not one .. too much but still ..\..\..\..\..\#dwn should be ..\..\..\..

share/grafx2:

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl-2.6.2530-issue45-win32\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\grafx2

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl2-2.6.2530-issue45-win32\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\grafx2

Bookmark_label =grafx2
Bookmark_directory = f:\#dwn\grafx2\grafx2-win32-2.6.2530-issue45-win32\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\grafx2-win32-2.6.2530-issue45-win32\share\grafx2

win32-api version does it strange again and others should use .

one directory up:

Bookmark_label = fonts
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl-2.6.2530-issue45-win32\share\grafx2\fonts

Bookmark_label = fonts
Bookmark_directory = fonts

Bookmark_label =fonts
Bookmark_directory = f:\#dwn\grafx2\grafx2-sdl2-2.6.2530-issue45-win32\share\grafx2\fonts

Bookmark_label = fonts
Bookmark_directory = fonts

Bookmark_label = fonts
Bookmark_directory = f:\#dwn\grafx2\grafx2-win32-2.6.2530-issue45-win32\share\grafx2\fonts

Bookmark_label = fonts
Bookmark_directory = ..\..\..\grafx2-win32-2.6.2530-issue45-win32\share\grafx2\fonts

and win32-api version makes it different again.

comment:31 Changed 14 months ago by Thomas Bernard

Grafx2 don't start in the bin dir. If not opening a file on command line, it sets "Load/Save?" directory to the current directory as reported by windows.
If you start a .exe by double clicking in the Windows explorer, that is the .exe directory.

But it can be another directory, if you set it otherwise with Lnk for example, or run from command line, etc.

comment:32 Changed 14 months ago by Thomas Bernard

@HoraK-FDF :
you can check the latest build :
https://gitlab.com/miniupnp/grafX2/-/jobs/159026664/artifacts/browse

comment:33 Changed 14 months ago by Thomas Bernard

Resolution: fixed
Status: acceptedclosed

comment:34 Changed 11 months ago by HoraK-FDF@…

Resolution: fixed
Status: closedreopened

Hi,

today I had time again until now the sdl and sdl2 versions look nice but the win32 version still does it wrong:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\grafx2-2.7wip2709\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\grafx2-2.7wip2709\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\grafx2-2.7wip2709\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\grafx2-2.7wip2709\share\grafx2

that's what the sdl/sdl2 version produce:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\grafx2-2.7wip2709\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\grafx2-2.7wip2709\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .

At the moment if i try to use Set Rel on a directory on a different drive as where grafx2 is the screen flashes red that's nice but in that case the Set Rel option can also deactivated.

and as for all version the do one unnecessary step if the directory is straight up:

Bookmark_label = #dwn
Bookmark_directory = f:\#dwn

Bookmark_label = #dwn
Bookmark_directory = ..\..\..\..\..\#dwn

at this point Bookmark_directory should be ..\..\..\..

Last edited 11 months ago by HoraK-FDF@… (previous) (diff)

comment:35 Changed 11 months ago by Thomas Bernard

1) it is possible that win32 and sdl/sdl2 version don't take the same base path to compute the relative directory.
Can you confirm whether or not it is actually working (ie changing to the expected directory) in both cases ?

2) well that's the way it is done... It is not a bug if that works properly.

comment:36 Changed 11 months ago by HoraK-FDF@…

1) as far that I see this it always goes 3 levels up so I think it starts at share/grafx2 but for:
Bookmark_directory = ..\..\..\grafx2-2.7wip2709\share\grafx2
it should be :
Bookmark_directory = .
as it is it is working but its strange and should work like all other versions.

2) yes it works but its not the standard relative paths are handled by any program/os I have seen in all the time and I think making it like all others do it is a great thing.

3) what do you think over the red flash is it better to do it that way or disabling Set Rel when current drive letter <> grafx2 drive letter?

comment:37 Changed 11 months ago by Thomas Bernard

1) I'm going to investigate.

2) It works and the result is correct. If the relative path generated by GrafX2 doesn't suit you for aesthetics reasons, you can edit the .ini file yourself

3) dynamically removing / adding the "Set Rel" option requires a major change in the code of the "dropdown" GrafX2 UI widget. I don't think that's worst the effort.
You should already be happy about how it is : Pulkomandy was against implementing the "set rel" option in the GUI.
If "Set Rel" is buggy, the best option for me would be to remove it from the GUI and letting the relative path feature be only possible by editing the .INI manually

comment:38 Changed 11 months ago by Thomas Bernard

I have the same result with the win32 API version :

  Bookmark_label = bin
  Bookmark_directory = C:\code\git\grafX2\bin

  Bookmark_label = bin
  Bookmark_directory = ..\..\bin

  Bookmark_label = grafx2
  Bookmark_directory = C:\code\git\grafX2\share\grafx2

  Bookmark_label = grafx2
  Bookmark_directory = .

I'm testing with my dev master, I'm going to test with the official grafx2-2.7wip2709 build

comment:39 Changed 11 months ago by Thomas Bernard

same results with grafx2-win32-2.7wip2709-win32.zip :

  Bookmark_label = bin
  Bookmark_directory = c:\TEMP\grafx2\2709\bin

  Bookmark_label = bin
  Bookmark_directory = ..\..\bin

  Bookmark_label = grafx2
  Bookmark_directory = c:\TEMP\grafx2\2709\share\grafx2

  Bookmark_label = grafx2
  Bookmark_directory = .

comment:40 Changed 11 months ago by PulkoMandy

To be clear, I'm not against a way to set relative paths from the UI, but I think it should be automatic, not a separate button:

  • If you set a bookmark on the same drive, use relative path, always
  • If you set a bookmark on another drive, use absolute path, always

The relative paths only are a problem if you move the grafx2 installation directory, which I find unlikely. If we want to improve on this, we could even store the GrafX2 install path, and check it is still the same (except the drive letter) or otherwise try to resolve the relative path from different bases until we locate a matching directory. This would be more transparent for the user and hopefully they wouln't look at what exactly we put in the .ini file then?

comment:41 Changed 11 months ago by Thomas Bernard

Resolution: fixed
Status: reopenedclosed

1) not reproducing
2) not a bug
3) not a bug

comment:42 Changed 11 months ago by HoraK-FDF@…

Resolution: fixed
Status: closedreopened

Hi,

I've found what causing this behavior of the win32 version I don't know if it is a problem of grafx2 or windows itself so I reopened the ticked if this was wrong then I'm sorry. I write all I did even if it was not successful: After I saw that it worked for you I thought maybe he is on another Windows version all until now was on windows xp sp3 so I tested it on windows 7 and windows 10 with the same result as always then i shortened the path and that was it, if any directory on the way to the grafx2 directory including itself is longer than 8 it will go back to the first directory witch is longer than 8 and star calculating from there here are some samples:

Bookmark_label = bin
Bookmark_directory = c:\12345678\12345678\12345678\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = c:\12345678\12345678\12345678\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .


Bookmark_label = bin
Bookmark_directory = c:\12345678\12345678\123456789\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\123456789\bin

Bookmark_label = grafx2
Bookmark_directory = c:\12345678\12345678\123456789\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\123456789\share\grafx2


Bookmark_label = bin
Bookmark_directory = c:\12345678\123456789\12345678\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\..\123456789\12345678\bin

Bookmark_label = grafx2
Bookmark_directory = c:\12345678\123456789\12345678\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\123456789\12345678\share\grafx2


Bookmark_label = bin
Bookmark_directory = c:\123456789\12345678\12345678\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\..\..\123456789\12345678\12345678\bin

Bookmark_label = grafx2
Bookmark_directory = c:\123456789\12345678\12345678\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\..\123456789\12345678\12345678\share\grafx2


Bookmark_label = bin
Bookmark_directory = c:\123456789\123456789\123456789\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\..\..\123456789\123456789\123456789\bin

Bookmark_label = grafx2
Bookmark_directory = c:\123456789\123456789\123456789\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\..\..\123456789\123456789\123456789\share\grafx2


The win32 version uses dos naming scheme somehow instead of long file names.

when bookmarking a long directory its clear to see:

Bookmark_label = GRAFX2~1.7WI
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~1.7WI

Bookmark_label = GRAFX2~1.7WI
Bookmark_directory = ..\..\..\GRAFX2~1.7WI

Bookmark_label = 123456~1
Bookmark_directory = c:\12345678\123456~1

Bookmark_label = 123456~1
Bookmark_directory = ..\..\..\..\..\12345678\123456~1

Bookmark_label = 123456~2
Bookmark_directory = c:\12345678\123456~2

Bookmark_label = 123456~2
Bookmark_directory = ..\..\..\..\..\12345678\123456~2

to 3)
please don't be angry with me and please don't remove it I didn't say that it is buggy, I'm perfectly happy with grafx2 and the feature, but I also think over ways to make it a bit better, that's why I'm spending much time to test it. I didn't know that it would be so difficult to implement it I'm not in the code at the moment in my thoughts it was only a if driveletter == gfx2drivletter then print/activate option. And to 2) I's no a bug but it's not the standard how relative path are handled by everyone that's all, I'm just a friend of a common standard that we all share.

There is another thing it also saves the Scripts_directory ini entry as dos name. And for all version if there was a relative path starting with . in Scripts_directory it fails, if it has started with .. it works. When Scripts_directory = the path displayed in the line under brush factory is in long names (for sdl/sdl2) but changing into a directory with long names the short name is used and is also save to the ini the win32 version always displays short names there. Is this something for a new ticket or let it here?

Last edited 11 months ago by HoraK-FDF@… (previous) (diff)

comment:43 Changed 11 months ago by Thomas Bernard

OK it must be an issue with the shortname/longnames in win32. What I don't understand is why the behaviour is different with the SDL/SDL2 version :(

comment:44 Changed 11 months ago by Thomas Bernard

OK, I have found several issues when running Grafx2 from a "UNICODE" path
Windows replace characters by '?' in path when getting them in ASCII :(

see https://gitlab.com/GrafX2/grafX2/merge_requests/203

@HoraK-FDF@… please test theses new binaries : https://gitlab.com/miniupnp/grafX2/-/jobs/217898406/artifacts/browse

comment:45 Changed 11 months ago by Thomas Bernard

if you have an issue with the script directory, please open a new ticket

comment:46 Changed 11 months ago by HoraK-FDF@…

Now the booth sdl versions do it the way the win32 did it and the win32 version does it like the like booth sdl versions before, also all three version use short names in the load/save dialog.

sdl:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\GRAFX2~2.7WI\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\GRAFX2~2.7WI\share\grafx2

sdl2:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\bin

Bookmark_label = bin
Bookmark_directory = ..\..\..\GRAFX2~2.7WI\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = ..\..\..\GRAFX2~2.7WI\share\grafx2

win32:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\GRAFX2~2.7WI\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .

and if no long name is in the path:
sdl:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\gfx2\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\gfx2\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .

sdl2:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\gfx2\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\gfx2\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .

win32:

Bookmark_label = bin
Bookmark_directory = f:\#dwn\grafx2\gfx2\bin

Bookmark_label = bin
Bookmark_directory = ..\..\bin

Bookmark_label = grafx2
Bookmark_directory = f:\#dwn\grafx2\gfx2\share\grafx2

Bookmark_label = grafx2
Bookmark_directory = .

comment:47 Changed 11 months ago by Thomas Bernard

it looks OK. In fact there is a bug in SDL/SDL2 they are using the Ascii version for getting the command line so it is not compatible with unicode path.

Just try to launch grafx2-sdl.exe from a path containing non ansi characters :
Like f:\Россия\

If using latin-1 characters (é à etc.) or just long Ascii name, it should work but get a long filename with sometimes some ???? characters inside...
I will try to workaround the problem, but in the meantime, it's better not to run the SDL and SDL2 windows version from a non "DOS compatible" path

what do you mean all three version use short names in the load/save dialog ?
Internally the shortnames are used, but the unicode name are supposed to be displayed in the dialog.
please attach screenshot

Changed 11 months ago by HoraK-FDF@…

Attachment: gfx2-load_save_sfn-01.png added

comment:48 Changed 11 months ago by HoraK-FDF@…

All three folders are 123456789 witch is all ascii. But how is it ok? Before all versions showed long names and stored them correctly it was only the bug with the win32 version that it was confused by a long file name in the path somehow and used it as start as seen in comment 35 for example.

Last edited 11 months ago by HoraK-FDF@… (previous) (diff)

comment:49 Changed 11 months ago by Thomas Bernard

Indeed only "short path" are displayed in the file selector under windows.
(in the file list box long/unicode names are displayed)
We should open another ticket for that issue.

under unix it correctly displays the unicode path, so that must be the win32 specific code that is buggy

comment:50 Changed 11 months ago by HoraK-FDF@…

lua output is also in short names will this be resolved automatically when this here is resolved or should I make a new ticket?

comment:51 in reply to:  50 Changed 11 months ago by HoraK-FDF@…

Replying to HoraK-FDF@…:

lua output is also in short names will this be resolved automatically when this here is resolved or should I make a new ticket?

lua and long names are still working in version grafx2-2.4.2035-win32 maybe there is a clue what has changed to make it not working anymore. So I'm back to 2.4 because I need long names in lua because my export scripts for GBA development create the array names from the file names and short names destroy to much information and the ~ in the name also create an compiler error.

Last edited 11 months ago by HoraK-FDF@… (previous) (diff)

comment:52 Changed 11 months ago by Thomas Bernard

please open separate tickets for separate bugs.
I really don't see how "Relative paths should always start from the same point" could have the lightest connection with a lua issue...

comment:53 Changed 11 months ago by HoraK-FDF@…

because it all seems to be connected with the bug in the windows long names handling.

comment:54 Changed 11 months ago by Thomas Bernard

Resolution: fixed
Status: reopenedclosed

please reopen only if the feature does not work (ie the setting of relative path fails, or changing to relative path fails)
For all other issues, please open a new ticket.

Note: See TracTickets for help on using tickets.