Opened 7 years ago

Closed 5 years 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 7 years ago.
gfx2-load_save_sfn-01.png (4.7 KB ) - added by HoraK-FDF@… 5 years ago.

Download all attachments as: .zip

Change History (56)

by HoraK-FDF, 7 years ago

Attachment: gx2_rel_mod_small.png added

comment:1 by HoraK-FDF, 7 years ago

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 7 years ago by HoraK-FDF (previous) (diff)

comment:2 by Thomas Bernard, 6 years ago

Owner: changed from pulkomandy to Thomas Bernard
Status: newaccepted

that should not be difficult to implement

comment:3 by PulkoMandy, 6 years ago

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 by Thomas Bernard, 6 years ago

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 by PulkoMandy, 6 years ago

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 by Thomas Bernard, 6 years ago

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 by Thomas Bernard, 6 years ago

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 by Thomas Bernard, 6 years ago

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

comment:10 by PulkoMandy, 6 years ago

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 by Thomas Bernard, 6 years ago

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:13 by Thomas Bernard, 6 years ago

@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 by PulkoMandy, 6 years ago

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 by Thomas Bernard, 6 years ago

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 by PulkoMandy, 6 years ago

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 by Thomas Bernard, 6 years ago

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 by PulkoMandy, 6 years ago

Milestone: 2.52.6

comment:19 by PulkoMandy, 5 years ago

Milestone: 2.62.7

Move open tickets to 2.7 milestone

comment:20 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

@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 by Thomas Bernard, 5 years ago

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

comment:23 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

@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 by PulkoMandy, 5 years ago

Yes, sounds fine

comment:28 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

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

comment:33 by Thomas Bernard, 5 years ago

Resolution: fixed
Status: acceptedclosed

comment:34 by HoraK-FDF@…, 5 years ago

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 5 years ago by HoraK-FDF@… (previous) (diff)

comment:35 by Thomas Bernard, 5 years ago

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 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by PulkoMandy, 5 years ago

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 by Thomas Bernard, 5 years ago

Resolution: fixed
Status: reopenedclosed

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

comment:42 by HoraK-FDF@…, 5 years ago

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 5 years ago by HoraK-FDF@… (previous) (diff)

comment:43 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

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 by Thomas Bernard, 5 years ago

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

comment:46 by HoraK-FDF@…, 5 years ago

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 by Thomas Bernard, 5 years ago

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

by HoraK-FDF@…, 5 years ago

Attachment: gfx2-load_save_sfn-01.png added

comment:48 by HoraK-FDF@…, 5 years ago

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 5 years ago by HoraK-FDF@… (previous) (diff)

comment:49 by Thomas Bernard, 5 years ago

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 by HoraK-FDF@…, 5 years ago

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

in reply to:  50 comment:51 by HoraK-FDF@…, 5 years ago

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 5 years ago by HoraK-FDF@… (previous) (diff)

comment:52 by Thomas Bernard, 5 years ago

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 by HoraK-FDF@…, 5 years ago

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

comment:54 by Thomas Bernard, 5 years ago

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.