pedrom34 / ZoteroPortable-dev-repo

Zotero in PortableApps.com Format - dev repo
https://portableapps.com/apps/office/zotero-portable
186 stars 13 forks source link

Can't run from path containing "Program Files" #19

Closed lukaszjablonski closed 3 years ago

lukaszjablonski commented 4 years ago

Describe the bug Can't run ZoteroPortable from any path that contain Program Files.

ZotteroPortable-error-Program_Files

It's OK to not allow it to be run from C:\Program Files\ZoteroPortable or C:\Program Files (x86)\ZoteroPortable but any other should be allowed (e.g. C:\Program Files (Portable)\ZoteroPortable)

It looks like similar problem to described here: https://portableapps.com/node/34720

To Reproduce Steps to reproduce the behavior:

  1. Install ZoteroPortable to C:\Program Files (Portable)\ZoteroPortable
  2. Run C:\Program Files (Portable)\ZoteroPortable\ZoteroPortable.exe
  3. See error
lukaszjablonski commented 4 years ago

Some more information also here: https://portableapps.com/node/54719

lukaszjablonski commented 4 years ago

If you use PortableApps.comLauncher then the restriction is checked in \PortableApps.comLauncher\Other\Source\Segments\PathChecks.nsh lines 11 to 21.

Any change here will cause "You're making me sad by the way you voided your warranty, running in Program Files." even if one would like to have Program Files (Portable) which is not a part of windows system.

pedrom34 commented 4 years ago

I'll take a look.

pedrom34 commented 4 years ago

I don't understand.

I use the latest version of LauncherGenerator and Installer, and still there's this issue even if John said it was addressed. I don't know how to fix this. But is it really a problem to use another folder like C:\Portable apps\ ?

lukaszjablonski commented 4 years ago

There are options, one can:

  1. Use different folder
  2. Add environment variable to the Windows settings (admin privileges might be necessary)
  3. Compile launcher yourself bypassing mentioned above path check (that's what I did, Program Files (Portable) pass check in my case)

I guess people might not be interested in that anyway so maybe you can forget about that. Sorry.

pedrom34 commented 4 years ago

Don't be sorry.

How did you compile the launcher? You removed lines 11 to 21?

lukaszjablonski commented 4 years ago

I modified

    ; Fear not, $PROGRAMFILES64 == $PROGRAMFILES32 on a 32-bit machine
    ${If} $EXEDIR startswith $PROGRAMFILES32
        StrCpy $0 $PROGRAMFILES32
    ${ElseIf} $EXEDIR startswith $PROGRAMFILES64
        StrCpy $0 $PROGRAMFILES64
    ${Else}
        StrCpy $0 ""
    ${EndIf}

to

    ${If} $EXEDIR startswith "C:\Program Files (Portable)"
        StrCpy $0 ""
    ; Fear not, $PROGRAMFILES64 == $PROGRAMFILES32 on a 32-bit machine
    ${ElseIf} $EXEDIR startswith $PROGRAMFILES32
        StrCpy $0 "$PROGRAMFILES32"
    ${ElseIf} $EXEDIR startswith $PROGRAMFILES64
        StrCpy $0 "$PROGRAMFILES64"
    ${Else}
        StrCpy $0 ""
    ${EndIf}

That works only for my case or anyone who sticks to C:\Program Files (Portable) idea.

lukaszjablonski commented 4 years ago

I believe that more generally one could also do

    ; Fear not, $PROGRAMFILES64 == $PROGRAMFILES32 on a 32-bit machine
    ${If} $EXEDIR startswith "$PROGRAMFILES32\"
        StrCpy $0 "$PROGRAMFILES32"
    ${ElseIf} $EXEDIR startswith "$PROGRAMFILES64\"
        StrCpy $0 "$PROGRAMFILES64"
    ${Else}
        StrCpy $0 ""
    ${EndIf}

to restrict only C:\Program Files\ and C:\Program Files (x86)\ but this is now going more into the PortableApps.com Launcher development not ZoteroPortable any more.

pedrom34 commented 4 years ago

but this is now going more into the PortableApps.com Launcher development not ZoteroPortable any more.

Yeah, I agree. Thanks for the info anyway. And this issue might help someone! :)