Menu

#1062 geany creates wrong folder when using relative path in project

v1.25
closed-fixed
None
v1.24.1
5
2014-08-12
2014-08-12
No

Hello,

I'm using geany 1.24.1 on Slackware64 14.1.

In project.c, when using path relative to the project filename, the base_path and the project filename's path are concatenated, but without any directory separator between them, which leads geany to create wrong folder.

For instance :

$ mkdir /tmp/projects
$ mkdir /tmp/projects/foo

1) without project file inside project base directory:

Edit > Preference > General >
Startup > Project files : /tmp/projects
Miscellaneous > Project > Store project file inside the project base directory = Off

Project > New
Name : foo
filename: /tmp/projects/foo.geany
base path: foo

Click button "create". Geany mistakenly asks to create the project's base path, because, at this point, the variable locale_path (line #686 in project.c) is set to "/tmp/projectsfoo" (instead of "projects/foo")

2) with project file inside project base directory :

$ mkdir /tmp/projects/bar

Edit > Preference > General >
Miscellaneous > Project > Store project file inside the project base directory = On

Project > New
Name : bar
filename: /tmp/projects/bar/bar.geany
base path: ./

Click button "create". Geany mistakenly asks to create the project's base path, because, at this point, the variable locale_path (line #686 in project.c) is set to "/tmp/projects/bar./" (instead of "projects/bar/./")

the attached patch solves this issue.

Hope this helps.

--
SeB

1 Attachments

Discussion

  • Lex Trotman

    Lex Trotman - 2014-08-12

    Edit > Preference > General >
    Startup > Project files : /tmp/projects
    Miscellaneous > Project > Store project file inside the project base directory = Off
    Project > New
    Name : foo
    filename: /tmp/projects/foo.geany
    base path: foo

    Setup like above, When I type foo in name the base path is /tmp/projects/foo not just foo??

     
  • Sébastien Ballet

    Hello,

    From base path's help :
    "base directory of all files that makes up the project. this can be a new path, or an existing directory tree. You can use paths relative to the project filename."

    By default, the project's base path is absolute:

    init-project

    You need to change it manually if you want the project's base path to be relative to the project's filename:

    set-relative

    Once you did that, geany is about to create the directory "foo" :

    create-dir

    However, if you change the line #696 in src/project.c from:

    _("The path \"%s\" does not exist."),

    To

    _("The path \"%s\" does not exist (locale_path=\"%s\")"),

    This shows you that geany is about to create the directory /tmp/projectsfoo :

    create-dir-with-errpath

    That's because the function g_strconcat is used at line #686 in src/project.c:

    SETPTR(locale_path, g_strconcat(dir, locale_path, NULL));

    --
    SeB

     

    Last edit: Sébastien Ballet 2014-08-12
  • Lex Trotman

    Lex Trotman - 2014-08-12

    oh, ok, you manually changed it to foo, I thought something else was wrong and giving the wrong field contents.

     
  • Lex Trotman

    Lex Trotman - 2014-08-12
    • status: open --> open-accepted
    • assigned_to: Colomban Wendling
     
  • Lex Trotman

    Lex Trotman - 2014-08-12

    Ok, yes the path is incorrectly generated, thanks for reporting.

     
  • Colomban Wendling

    • status: open-accepted --> closed-fixed
    • Fixed in: v1.24.1 --> v1.25
     

Log in to post a comment.