You are here

Things I miss in portable apps launcher's rewrite

5 posts / 0 new
Last post
5keeve
Offline
Last seen: 9 years 10 months ago
Joined: 2012-07-12 15:13
Things I miss in portable apps launcher's rewrite

As you might have seen I'm trying to make jEdit portable.

While I was working on the [FileWriteN] sections I noticed some shortcomings.

I think the only rally valuable type is the "Replace" as all the others simply seem to spit out some, more or less, fixed lines.

What I wanted to do, for example, is to replace something in an XML file.


<PERSPECTIVE>
<BUFFER AUTORELOAD="TRUE" AUTORELOAD_DIALOG="TRUE">F:\PortableApps\jEditPortable\App\AppInfo\Launcher\jEditPortable-5keeve.ini
<VIEW PLAIN="FALSE">
<PANES>
"F:\\PortableApps\\jEditPortable\\App\\AppInfo\\Launcher\\jEditPortable-5keeve.ini" buffer "F:\\PortableApps\\jEditPortable\\App\\AppInfo\\Launcher\\jEditPortable-5keeve.ini" buff "global" bufferset
...

So here an XPath like "/PERSPECTIVE/BUFFER/VIEW/PANES" would help locate the textnode where I would need to apply a replace

Another example is a (kind of) INI file:

[user.showDualDiff.basefile]
F:\\PortableApps\\Documents\\file1.txt
F:\\PortableApps\\Documents\\file2.txt
P:\\x\\e
...
[console.System]
F:/PortableApps/PuTTYPortable/plink -load DefaultProduction -ssh -l jboss nagioshost \'cd /opt/SP/apps/nagios/bin ; cs=./control-Nagios-Production; if \[ ! -x $cs \] ; then cs=./control-nagios ; fi ; $cs svntestfly && $cs svnup && $cs restart && echo $cs: restarted\'\"
...
[sftp.privateKey]
F:\\OtherApps\\portablePuTTY\\keys\\jboss57
F:\\PortableApps\\PuTTYPortable\\Data\\jboss57
F:\\PortableApps\\PuTTYPortable\\Data\\vfsshm

Where I *think* it would be good to be able to define the sections where to replace.

Additionally I think, we could benefite if a search string can be "anchored":
^%PAL:LastPortableAppsBaseDir:DoubleBackslash%
would mean that the string has to be at the start of a line.

And while we are at it, full regular expressions would even be better:
([">])%PAL:LastPortableAppsBaseDir:DoubleBackslash%
means that either " or > has to be before that string and the replacement
$1%PAL:PortableAppsBaseDir:DoubleBackslash%
would insert the matched character (because of the round brackets) at the position of the $1

Update: I just noticed: It seems to be not possible to define wildcards for the files to be rewritten Sad
The ProjectViewer plugin for jEdit generates several files with names defined by the user. So it is not possible, at the moment, to define rewrites for this Sad

John T. Haller
John T. Haller's picture
Online
Last seen: 4 min 26 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Specific Reasons

Having INI, Config and XPath options are specifically for instances where you need to write a path out on every launch. For example, writing a full path to plugins or themes of the sort %PAL:AppDir%\AppName\plugins. Lots of apps use these. Just because the app you are working on does not need this functionality doesn't mean it's not important.

As for Replace, it's for a specific file and there are formats for all standard path representations. I've never seen a need to replace a path in one section of an INI but not another. You replace them file wide, just ensuring you get enough of a leader or trailer so it doesn't accidentally replace other stuff. We do replacements in XML files for seberal apps in this way. And you'll just need two entries to represent with the > and with the " instead of one with regular expressions. We don't have a file replacement regular expressions component for NSIS. If you'd like to write one or know someone who would, we'd be happy to include it.

As for file path wildcards, most apps have specific files defined that contain settings. Unfortunately, some plugins vomit up lots of different configuration files. At present, the only way to handle those is via custom code, unfortunately. Luckily, it's rare enough that this isn't usually an issue. Unfortunately for you, jEdit is one of the unlucky apps that needs this. Or at least that specific plugin. You can use custom code with FindFirst and a DoWhile loop to loop through all the matching files and then replace code within said loop. You can find an example of said loop in ControlPadPortable's custom.nsh and an example of the appropriate ReplaceInFile call within FreeFileSyncPortable's custom.nsh.

Sometimes, the impossible can become possible, if you're awesome!

5keeve
Offline
Last seen: 9 years 10 months ago
Joined: 2012-07-12 15:13
Thanks for your reply. Can

Thanks for your reply.

Can you give me a hint how to implement this "wildcardish" behaviour? I looked at https://portableapps.com/manuals/PortableApps.comLauncher/advanced/custo... and it seems a bit generic to me.

Or maybe tel me which of the hundred nsis files of the launcher to best look at to learn the most from it?

John T. Haller
John T. Haller's picture
Online
Last seen: 4 min 26 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Specific Files

Re-Read my post. I point out two specific custom.nsh files in two specific apps that have both pieces of the code you'd need. I searched through all the custom code in all 300+ apps to find it. Download those apps and browse to their respective App\Launcher directories and look at their custom.nsh.

Sometimes, the impossible can become possible, if you're awesome!

5keeve
Offline
Last seen: 9 years 10 months ago
Joined: 2012-07-12 15:13
Oops Sorry! Will try it.

Oops Sad Sorry! Will try it.

Log in or register to post comments