WinXP2: Command line file names not current dir relative

Bug #167455 reported by Edavies on 2006-04-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Krzysztof Kosinski

Bug Description

Relative file names put on the command line for the
Windows (XP SP2) version of Inkscape are taken to be
relative to the Inkscape installation directory rather
than the current directory.

The name of the file to be opened has to be fully
qualified otherwise it's not found. If the name of the
file for the --export-png option does not have any
directory specification then the exported file is put
in the Inkscape directory (e.g., C:\Program
Files\Inkscape 0.43) rather than the current directory.

This is a right pain if you want to create a make file
which is portable across multiple systems.

This problem doesn't seem to apply on Linux (Ubuntu)
where the current directory is used correctly.

Related branches

Johan Engelen (johanengelen) wrote :

Originator: NO

See also [ 1603604 ].
Added to to-do list.

theAdib (theadib) wrote :

this might be fixed pls doublecheck with SVN

Changed in inkscape:
status: New → Incomplete
Rygle (rygle) wrote :

This seems to have been reported against Inkscape 0.43, and was put on Johan's list a long time ago.

Is this still a problem with 0.46? Johan? Edavies?

Assigned to me and I will close this if I don't hear back soon.

Changed in inkscape:
assignee: nobody → rygle
Edavies (edavies) wrote :

Yes, this problem still exists in 0.46.

That's with the Windows version available on Sourceforge which I downloaded within the last hour or so. March 10th I think it said there.

Attached is text from screen showing running Inkscape through a trivial batch file. "happy.svg" doesn't work but "c:\temp\happy.svg" does.

Rygle (rygle) wrote :

Changing to confirmed. Milestoning for 0.47. Johan, have you made any progress on this?

Edavies test case is as follows;
C:\Temp>type c:\bin\inkscape.bat
"C:\Program Files\Inkscape 0.46\inkscape.exe" %1 %2 %3 %4 %5
C:\Temp>inkscape happy.svg

C:\Temp>"C:\Program Files\Inkscape 0.46\inkscape.exe" happy.svg

C:\Temp>inkscape c:\temp\happy.svg

C:\Temp>"C:\Program Files\Inkscape 0.46\inkscape.exe" c:\temp\happy.svg


Changed in inkscape:
milestone: none → 0.47
status: Incomplete → Confirmed
Krzysztof Kosinski (tweenk) wrote :

This is the relevant snippet of code from main() in main.cpp. What should be done instead is that _win32_getExePath should be called whenever a resource is requested. This isn't a trivial change since it requires refctoring how Inkscape's datafiles are accessed.

#ifdef WIN32
      Set the current directory to the directory of the
      executable. This seems redundant, but is needed for
      when inkscape.exe is executed from another directory.
      We use relative paths on win32.
      HKCR\svgfile\shell\open\command is a good example
    Glib::ustring homedir = _win32_getExePath();
    RegistryTool rt;

Chris Morgan (chris.morgan) wrote :

Another way it could be done (I'd been thinking of doing it for my applications, especially Inkscape incidentally) is by just analysing the command line, and seeing if it's a file which exists. If it is, use the shlwapi.dll PathCombine DLL call (there may be a better way of doing it, but I doubt it). I believe that PathCombine will work even if it's an absolute path, but if not you'd need to do something like, does it start with \\ or is the second character : or something like that.

That'd be simpler than changing all the resource request lines.

ScislaC (scislac) on 2009-11-24
Changed in inkscape:
milestone: 0.47 → none
jazzynico (jazzynico) on 2009-12-19
tags: added: cli
removed: other
Krzysztof Kosinski (tweenk) wrote :

Chris Morgan: this would still be an ugly hack. We need to reduce the number of hacks in Inkscape, because we already at the brink of collapse into unmaintainability. All that needs to be done is to modify the profile_path function.

Changed in inkscape:
assignee: Rygle (rygle) → Krzysztof Kosinski (tweenk)
status: Confirmed → In Progress
Krzysztof Kosinski (tweenk) wrote :

This should be fixed in 9281. You can type "inkscape tiger.svgz --export-png=tiger.png" with Inkscape's directory added to your PATH and it will behave just like on Unix.

profile_path is about user configuration rather than Inkscape's datafiles, so it wasn't relevant to this bug - sorry if this caused any confusion.

Changed in inkscape:
status: In Progress → Fix Committed
milestone: none → 0.48
jazzynico (jazzynico) on 2010-08-24
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments