tedsmith / quickhash

Graphical cross platform data hashing tool for Linux, Windows and Mac
http://www.quickhash-gui.org
GNU General Public License v2.0
366 stars 37 forks source link

Windows installer #49

Open ravage84 opened 5 years ago

ravage84 commented 5 years ago

Hi Ted,

The about page on the product website of QuickHash states:

No installation needed making it portable and easy to run or delete after use. ... No installation. No wizards. No registration. Just double click and use, instantly (or Linux users can also use Debian packages to install if they wish)

I agree, it is very nice to not need to execute an installer/installation wizard to be able to use a small tool such as QuickHash. Nonetheless, in a business environment it can be mandatory to pre-install tools or at least make the permanent installation of a tool throughout several machines more convenient. This is where an installater/installation wizard comes in.

Because I felt it would be even cooler for QuickHash to provide such an installer (for Windows at least), because I have some experience in creating installation scripts with NSIS (Nullsoft Scriptable Install System) and because just for fun, I created an NSIS based installer script for QuickHash.

Actually, I provided two variants. They are pretty much the same but they install QuickHash into different folders (by default):

  1. the program files, e.g. ``C:\C:\Program Files (x86)\QuickHash\" #51
  2. the local app data folder, e.g. "C:\Users\Ravage\AppData\Local\QuickHash" #50

Problem with the first is, that QuickHash tries to write the UI state into an XML file within the same folder, which doesn't work because of missing write privileges on that folder. Thus, currently only the second installer works without problems.

Let me know, if you want to include the installer script into QuickHash. It was fun fiddling around, anyway.

tedsmith commented 5 years ago

Wow! This looks great!! Thank you very much. I will have to check it over when I get some time. I see the merge requests and will have a look over Christmas period hopefully. Don’t be stressed if it takes me a while to get back to you. Time is limited currently.  Thanks again Ted

Sent from Yahoo Mail for iPhone

On Monday, December 17, 2018, 6:58 pm, Marc Würth notifications@github.com wrote:

Hi Ted,

The about page on the product website of QuickHash states:

No installation needed making it portable and easy to run or delete after use. ... No installation. No wizards. No registration. Just double click and use, instantly (or Linux users can also use Debian packages to install if they wish)

I agree, it is very nice to not need to execute an installer/installation wizard to be able to use a small tool such as QuickHash. Nonetheless, in a business environment it can be mandatory to pre-install tools or at least make the permanent installation of a tool throughout several machines more convenient. This is where an installater/installation wizard comes in.

Because I felt it would be even cooler for QuickHash to provide such an installer (for Windows at least), because I have some experience in creating installation scripts with NSIS (Nullsoft Scriptable Install System) and because just for fun, I created an NSIS based installer script for QuickHash.

Actually, I provided two variants. They are pretty much the same but they install QuickHash into different folders (by default):

1.the program files, e.g. ``C:\C:\Program Files (x86)\QuickHash"

Problem with the first is, that QuickHash tries to write the UI state into an XML file within the same folder, which doesn't work because of missing write privileges on that folder. Thus, currently only the second installer works without problems.

Let me know, if you want to include the installer script into QuickHash. It was fun fiddling around, anyway.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ravage84 commented 5 years ago

No problem. If you want me to send you the precompiled installers from both version or need help compiling them, just say so. You can also reach me by mail or Skype.

darealshinji commented 5 years ago

Problem with the first is, that QuickHash tries to write the UI state into an XML file within the same folder, which doesn't work because of missing write privileges on that folder.

This is default behavior on Windows and Mac if the filename wasn't set. On Linux it's saved as a hidden file in the user's directory. https://github.com/tedsmith/quickhash/commit/aa12cd8a8717df9fa45eafdcb81215d71049e0be http://wiki.lazarus.freepascal.org/TXMLPropStorage

I don't know if the filename can be set for each OS in a dynamic way inside unit2.pas. My suggestion would be something like $HOME/.config/QuickHash/PropStorage.xml on Mac and Linux and %LocalAppData%\QuickHash\PropStorage.xml on Windows (with a fallback check of %AppData% if you really want to support XP).

ravage84 commented 5 years ago

My suggestion would be something like $HOME/.config/QuickHash/PropStorage.xml on Mac and Linux and %LocalAppData%\QuickHash\PropStorage.xml on Windows (with a fallback check of %AppData% if you really want to support XP).

@darealshinji sounds reasonable.

darealshinji commented 5 years ago

Weird, it doesn't seem to save the configuration. It always remains the same:

<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
  <TApplication>
    <MainForm MainForm_Position="poScreenCenter"/>
  </TApplication>
</CONFIG>

By the way, using the following code seems to help to save the file in a specific user directory:

  {$ifdef Windows}
    envVar := GetEnvironmentVariable('LocalAppData'); // XP only has %AppData%
    if envVar <> '' then
    begin
      if DirectoryExists(envVar + '/QuickHash') = false then
      begin
        CreateDir(envVar + '/QuickHash');
      end;
      if DirectoryExists(envVar + '/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}

  {$ifdef UNIX}
    envVar := GetEnvironmentVariable('HOME');
    if envVar <> '' then
    begin
      // $HOME/.config should already exist on Mac and Linux
      if DirectoryExists(envVar + '/.config/QuickHash') = false then
      begin
        CreateDir(envVar + '/.config/QuickHash');
      end;
      if DirectoryExists(envVar + '/.config/QuickHash') = true then
      begin
        QH_MainFormXMLPropStorage.FileName := envVar + '/.config/QuickHash/PropStorage.xml';
      end;
    end;
  {$endif}

Only tested on Linux so far.

ravage84 commented 5 years ago

@darealshinji

Weird, it doesn't seem to save the configuration. It always remains the same:

Could you create a issue for that?

By the way, using the following code seems to help to save the file in a specific user directory:

Can we move this discussion to a separate issue?

darealshinji commented 5 years ago

Can we move this discussion to a separate issue?

https://github.com/tedsmith/quickhash/issues/57