After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618646 - Should be able to run gnucash-bin.exe directly, rather than gnucash.cmd
Should be able to run gnucash-bin.exe directly, rather than gnucash.cmd
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Windows
2.3.x
Other Windows
: Normal enhancement
: ---
Assigned To: Geert Janssens
Christian Stimming
: 605825 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-05-14 16:08 UTC by Tao Wang
Modified: 2018-06-29 22:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch will make it's possible to run gnucash-bin.exe directly (12.56 KB, patch)
2010-05-20 18:22 UTC, Tao Wang
accepted-commit_now Details | Review
Fixed a bug in previous patch (12.34 KB, patch)
2010-05-25 09:45 UTC, Tao Wang
committed Details | Review

Description Tao Wang 2010-05-14 16:08:01 UTC
There is no conditional logic in gnucash.cmd. The file is only for setting environment variables. We can set those environment variables to system or user during the installation. Then it's not necessary to use 'gnucash.cmd' as a wrapper.
Comment 1 Geert Janssens 2010-05-15 12:25:45 UTC
Yes, this was one of my goals when I created the environment config file. But I haven't found the time to complete this part (that and my slow Windows VM which makes the tests much slower than should be).

There are a few things that have to be sorted out before this can be completed.
* gnucash.com is different when install.sh has run from the gnucash.cmd that gets installed by the ISS installer.
* Most of the environment for GnuCash can be configured in etc/gnucash/environment, that is all but the path(s) to the gnucash binaries. The point is that this config file has to be found by the gnucash binary. On linux this is a no-brainer, on Windows I will have to investigate this a bit more. This environment config file will need to have slightly different content depending on how gnucash was installed, similar to the gnucash.com file it's trying to replace.
* Simply putting all this information directly in the environment at install time is not a good idea for several reasons. I think for example about installing several independent instances of GnuCash (for testing or other purposes). Setting this in the global environment makes that these settings are shared between gnucash instances.
* ...
Comment 2 Christian Stimming 2010-05-15 20:23:38 UTC
(In reply to comment #1)
> * Most of the environment for GnuCash can be configured in
> etc/gnucash/environment, that is all but the path(s) to the gnucash binaries.
> The point is that this config file has to be found by the gnucash binary. On
> linux this is a no-brainer, on Windows I will have to investigate this a bit
> more.

Isn't this a problem that can be solved using g_win32_get_package_installation_directory_of_module () ?
Comment 4 Tao Wang 2010-05-20 18:22:42 UTC
Created attachment 161579 [details] [review]
Patch will make it's possible to run gnucash-bin.exe directly

I made a patch to this problem. I build it against r19185, and it can run gnucash-bin.exe directly. The patch contains following modifications:

1) Change desktop icon, start menu links to gnucash-bin.exe instead of gnucash.cmd

2) Modify packaging/win32/gnucash.iss.in to create etc\gnucash\environment file during the installation.

3) Move all lib/gnucash/lib*.dll files to bin/ on Windows only. So, gnucash-bin.exe will find all linked .dll files.

4) Change gnc_path_get_pkglibdir(), if current system is WIN32, return bin/. This is the workaround for the functions need to load .dll files in 'pkglibdir' which are already moved to bin/

5) When loading gnc module, adding a filename prefix filter to check whether the filename is begin with "libgncmod". The reason is after moving lib/gnucash/lib*.dll to bin/, those files will mixed with other libraries on Windows, which are definitly not gnc module, such as gtk+, cairo .dll files. In most case they are easily ignored. However, for some libraries, there will be an error warning prompt on Windows. To avoid load unnecessary files, the prefix "libgncmod" is checked when loading the file. If it is begin with 'libgncmod', that means it's more likely a gnc module. Since, the prefix is kept for all platform, I didn't add #ifdef G_OS_WIN32 around that filter.

6) If GNC_CONFIG_PATH, GNC_SHARE_PATH is not set before running gnucash-bin.exe, the main() will use the compiled path instead. And environment_override() will find the 'etc/gnucash/environment' against that path. The default path should not be the linked one, they should be based on the current executable file location. So, change the default config_path, share_path and help_path to the result of 'gnc_path_get_*dir()', which is based on the current executable location. It is still easily override by the environment variables. I'm not sure whether all platform should be the same way, so I made this behavior WIN32 only.
Comment 5 Christian Stimming 2010-05-21 12:07:59 UTC
Comment on attachment 161579 [details] [review]
Patch will make it's possible to run gnucash-bin.exe directly

Looks good to me. All functional changes are limited to G_OS_WIN32 which IMHO means they are just fine.
Comment 6 Tao Wang 2010-05-25 09:45:35 UTC
Created attachment 161923 [details] [review]
Fixed a bug in previous patch

Found a bug in previous patch, fixed it, and recreate the patch.

Change:

-        mv bin/*.dll gnucash 2>/dev/null || true
+        mv bin/*.dll $_INSTALL_UDIR/bin 2>/dev/null || true

To

-        mv bin/*.dll gnucash 2>/dev/null || true
+        mv bin/*.dll gnucash/*.dll $_INSTALL_UDIR/bin 2>/dev/null || true

Not only lib/bin/*.dll should be copied to bin/, but also lib/gnucash/*.dll.
Comment 7 Christian Stimming 2010-05-25 10:54:58 UTC
Comment on attachment 161923 [details] [review]
Fixed a bug in previous patch

ok
Comment 8 Geert Janssens 2010-05-25 20:56:45 UTC
Comment on attachment 161923 [details] [review]
Fixed a bug in previous patch

In r19204. Thank you very much.
Comment 9 Geert Janssens 2010-07-15 10:04:02 UTC
*** Bug 605825 has been marked as a duplicate of this bug. ***
Comment 10 John Ralls 2018-06-29 22:39:20 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=618646. Please update any external references or bookmarks.