This PR enables opening folders with Geany. Resolves #1171, others.
* Folders are turned into projects. + Project name is set to the basename of the folder. May be changed from *Project / Properties*. + When the `project_file_in_basedir` option is set, the `.geany` file is created inside the folder with name `[basename].geany`. + Otherwise, `.geany` files are stored in `~/.cache/geany/folders/` with name `[basename]_[path-md5].geany`. * If the folder already has a project file (as noted above), the project file is opened. * Folders to open may be specified at the command line. Any filenames following the folder name are added to the project. * New menu items: + *Project / Open Folder...* + *Project / Save As...* – to resave temporary project file to permanent location or to fork existing project to a different file. * Does *not* interfere with existing method of project creation.
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3044
-- Commit Summary --
* Open folders as project
-- File Changes --
M data/geany.glade (18) M src/callbacks.c (14) M src/libmain.c (62) M src/main.h (2) M src/project.c (166) M src/project.h (8)
-- Patch Links --
https://github.com/geany/geany/pull/3044.patch https://github.com/geany/geany/pull/3044.diff
@xiota pushed 1 commit.
29757b8e743a38996bad6e2fbee71e68a9de4573 fix win32 code
What happens if user supplies two directories on command line, where both contain a project?
IMHO opening a project just by specifying it's directory might be confusing. If I'd want to open a project, I'd pass it's project file as argument (which already works well). As for passing directory on command line, much more intuitive behaviour (again just my own opinion) would be to open all files in the directory. Creating a new project could be quite a surprise, especially for users who don't usually use projects.
IMO the biggest problem of this proposal is that it introduces yet another (this time hidden) place where project files are stored. We already have 1. Inside the project directory 2. Outside the project directory
and what this proposal does is it introduces yet another mode:
- outside the project directory at a place which isn't meant to be permanent and which is more or less hidden from normal use and where it isn't clear if it exists or not
Now imagine a user created a `my_project.geany` file inside his `basename` directory and runs Project->Open folder on it. He certainly expects the previously created project is opened like in any other editor but instead, the new, hidden project is created.
Or imagine the user just happily uses this feature only and then deletes the `.cache` directory because he thinks it contains just temporary files. Of course, it could be also in `.config` but the problem of more-or-less-invisible project files stored at a location that is totally separate from the project still remains.
IMO the main problem here is that we just simply can't implement the "Open folder" feature with the current way projects work in Geany without doing something ugly. I think there are just 2 right options here: 1. Force users to have their project file in the root of their base name (or some project directory) under a fixed name - then "Open folder" will just work like in any other editor 2. Just update existing project opening to improve existing behavior which is what I try in #3042 (and #3018 before)
As I think (1) won't pass, I tried doing (2).
@xiota pushed 4 commits.
78f71d6d91b870cb014defba080cea8cdfc51fba use command line option instead of handling folders directly 5214dd7dc663d7c3917aa6c3d8049335a6a43a42 make socket behavior match initial startup behavior a6900d397c22f15d86c7b3865926906e0a31a483 update manual c806c355543d6cf8de5ea0c7c2c7de35445036d0 update manual
What happens if user supplies two directories on command line, where both contain a project?
Previously, the project/folder would be opened/created, files added, then the next project/folder would be opened/created (closing the previous), etc. This is problematic when opening multiple files with shell globs that could refer to folders. So I'm changed the feature to use a command-line flag.
IMHO opening a project just by specifying it's directory might be confusing. If I'd want to open a project, I'd pass it's project file as argument (which already works well).
Thank you for reminding me that I need to update the manual.
The intent is to add folder handling. The mechanism is via projects. (Other editors/IDEs have been reported to behave similarly.) This is useful when combined with a plugin that displays folder contents in the sidebar. Otherwise, it's not very useful and can just be ignored.
As for passing directory on command line, much more intuitive behaviour (again just my own opinion) would be to open all files in the directory.
This behavior would also have problems with shell globs. Many folders have thousands of files, and Geany would appear to be frozen/crashed/broken while loading so many files. The current Geany behavior is to drop folders in some cases (currently, initial startup and socket behavior do not match; I've added changes to address this).
Creating a new project could be quite a surprise, especially for users who don't usually use projects.
Switching to using a command-line flag should resolve this. From the menu, there are clues that Projects are involved.
@xiota pushed 1 commit.
7852db3944f61fea5ddabc6dfa854087d464273f fix for mingw (gtk 3.8.2 does not have g_file_new_build_filename)
@xiota pushed 1 commit.
509c7ed06217e10a5f3702387ff0bfeb1acc1bbd more instances of g_file_new_build_filename
@xiota pushed 1 commit.
7ee1c403bc9b03e406358695ab300c5d27dd57f4 fix focus behavior on socket communication
github-comments@lists.geany.org