Zim

Allow customizing plugin external commands

Bug #987572 reported by Brendan Kidwell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zim
In Progress
Medium
Unassigned

Bug Description

I am trying to get the Ditaa plugin to work in Windows. It looks for an executable file in $PATH called 'ditaa'.

I have in my $PATH a ~/bin folder, and I created a launcher in there for ditaa called 'ditaa.cmd'. It contains the following line of code:
   java -jar "C:\Users\kidwellb\Apps\Ditaa\ditaa0_9.jar" %*
and it should work just fine for invoking Ditaa.

The Ditaa plugin doesn't think the Ditaa CLI tool exists -- it doesn't find my launcher file. I looked into the code. See http://bazaar.launchpad.net/~jaap.karssenberg/zim/pyzim/view/head:/zim/applications.py Application#_lookup()

In Windows, _lookup() looks for the presence of '$launcher' and '$launcher.exe'. It should also look for these file extensions in addition to 'exe', which may be used to launch a command line tool: cmd, bat, vbs, py, pl, js, jar. (And others?)

Sorry I can't submit a patch because I don't quite understand the logic of this function. (What is the meaning of the 'else' clause following the 'for' statement? Is this legal?)

summary: - Application class doesn't find plugin executable exists in Windows
+ Windows: Application class says plugin executable doesn't exist
description: updated
Revision history for this message
Brendan Kidwell (bkidwell) wrote : Re: Windows: Application class says plugin executable doesn't exist

I was viewing rev 534 of applications.py which corresponds to release 0.56.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 987572] [NEW] Windows: Application class says plugin executable doesn't exist

On Tue, Apr 24, 2012 at 1:58 AM, Brendan Kidwell
<email address hidden> wrote:
> In Windows, _lookup() looks for the presence of '$launcher' and
> '$launcher.exe'. It should also look for these file extensions in
> addition to 'exe', which may be used to launch a command line tool: cmd,
> bat, vbs, py, pl, js, jar. (And others?)

Seems to me that it will be hard to get an extensive list. Maybe just
check for the name with any extension and assume it will be executable
?

> Sorry I can't submit a patch because I don't quite understand the logic
> of this function. (What is the meaning of the 'else' clause following
> the 'for' statement? Is this legal?)

Yes, the "else" is executed if the "for" finishes without a break.
See http://docs.python.org/reference/compound_stmts.html#the-for-statement
for details.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: Windows: Application class says plugin executable doesn't exist

Generic mechanism for plugins to specify external application: store command in .desktop file, allow user to customize it from the preferences dialog.

Changed in zim:
status: New → Confirmed
importance: Undecided → Medium
summary: - Windows: Application class says plugin executable doesn't exist
+ Allow customizing plugin external commands
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Committed fix that will use the "PATHEXT" environment variable to detect what file extensions should be executable. This should solve original issue. More configuration for the complete command still open.

Changed in zim:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.