svgtofont icon indicating copy to clipboard operation
svgtofont copied to clipboard

Wrong absolute paths

Open mmjvox opened this issue 3 years ago • 3 comments

Im using cmake to generate font in build steps, cmake fills the input and output directories. There is no problem with cmake commands, This program (svgtofont) goes wrong with absolute paths.

cmake definitions:

set(SVG_ICONS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources/svgFont/svg)
set(FONTICONS_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated_font)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/svgFont/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json)

package.json.in file:

//  /home/.../project/fonts/package.json.in
"scripts": {
    "font": "svgtofont --sources @SVG_ICONS_DIR@ --output @FONTICONS_OUTPUT_DIR@"
  }

generated package.json file:

//   /home/.../project_build/fonts/package.json
"scripts": {
    "font": "svgtofont --sources  /home/.../project/fonts/svg --output  /home/.../project_build/generated_font"
  }

error:

The directory does not exist! /home/.../project_build/home/.../project/fonts/svg

It appends input path to running path ( the result is someting like this /home/.../project_build/home/.../project/fonts/svg)

A real example:

[user1@fedora GUI]$ npm run font

> font
> svgtofont --sources /home/user1/projects/MainApp/plugins/GUI/resources/svgFont/svg --output /home/user1/builds/build-MainApp-Desktop_Qt_5_15_2_GCC_64bit-Debug/plugins/GUI/generated_font

The directory does not exist! /home/user1/builds/build-MainApp-Desktop_Qt_5_15_2_GCC_64bit-Debug/plugins/GUI/home/user1/projects/MainApp/plugins/GUI/resources/svgFont/svg

I even tested it without cmake and it still had this problem.

mmjvox avatar Jun 25 '22 09:06 mmjvox

@mmjvox The directory does not exist!

jaywcjlove avatar Jun 25 '22 09:06 jaywcjlove

Of course, it is clear that this directory does not exist. 😁😀 Both of --sources and --output directories are exists. But it is not clear why looks for the wrong path that does not exist

I updated my description.

mmjvox avatar Jun 25 '22 10:06 mmjvox

I have no way of knowing the reason for your error. @mmjvox

jaywcjlove avatar Jun 25 '22 15:06 jaywcjlove

I am also running into this issue. I want to supply an absolute path to `--sources``, but when I do, it appends the path to the current working directory.

The code is here: https://github.com/jaywcjlove/svgtofont/blob/51fd8c5b4b3aa1da211e612b36837b31f2bdc19a/src/cli.ts#L28

Here the --sources value is appended to the current directory, which means that it is not possible to give an absolute path to --sources and --output. Is there perhaps a workaround for this?

exil avatar Nov 15 '22 14:11 exil

@exil Thank you for your explanation, I get it. I fixed it

Upgrade v3.20.0

jaywcjlove avatar Nov 15 '22 14:11 jaywcjlove