Far 2 build 1148+ Warning for Plugin Developers

A place where plug-in developers can share their knowledge and experience.
Post Reply
free3dom
Posts: 20
Joined: Sat 15 Aug, 2009 18:54

Far 2 build 1148+ Warning for Plugin Developers

Post by free3dom »

To all plugin devs:

I have had two plugins (one of my own) break after build 1148+ (I actually first found it in b1151, but was told by someone it started in b1148). The reason for the "break" is that FAR no longer sets the current working directory of the process to that of the active panel (or changes it when a plugin runs?). This means that using a filename from the active panel (without prefixing with the path) results in a "file not found" - I didn't check what the CWD was, but it is definitely not the current panel.

I don't know if this is intentional or a bug...couldn't find anything about it in the changelog (which I had to translate from russion, so it may be there). But this is a fairly big change that could potentially break any existing plugin that accesses selected items or all items in the current panel (where I used to assume, correctly, that it was the current working directory).

Anyway, to circumvent this I just manually set the current working directory upon startup of my plugin and the rest of the code could run unchanged.

Assume Nothing...Trust No One :ha:
User avatar
Px
Posts: 826
Joined: Fri 08 Sep, 2006 15:52
Location: Вишнёвый (под Киевом)
Contact:

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by Px »

FCTL_GETCURRENTDIRECTORY ?
Игорь Юдинцев
Posts: 726
Joined: Sun 03 Apr, 2005 22:00
Location: Казань
Been thanked: 2 times

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by Игорь Юдинцев »

free3dom wrote:couldn't find anything about it in the changelog (which I had to translate from russion, so it may be there).
http://farchangelog.blogspot.com
the post for build #1145.
Max Rusov
Posts: 3651
Joined: Wed 23 Nov, 2005 11:11
Location: Москва-Питер
Has thanked: 2 times
Been thanked: 19 times

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by Max Rusov »

User avatar
HaRT
Moderator
Posts: 10823
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by HaRT »

free3dom wrote:I don't know if this is intentional or a bug
This is intentional; see b.1145 at http://farchangelog.blogspot.com/2009/09/11451148.html.
free3dom wrote:Anyway, to circumvent this I just manually set the current working directory upon startup of my plugin and the rest of the code could run unchanged.
Please note that your code will probably fail on long paths due to SetCurrentDirectory limitations.
Фар есть инструмент, а не нянька. © 2009 DrKnS
free3dom
Posts: 20
Joined: Sat 15 Aug, 2009 18:54

Re: Far 2 build 1148+ Warning for Plugin Developers

Post by free3dom »

Thanks for the replies, never knew about the english changelog...that'll be handy :Yahoo!:

I am aware that the SetCurrentDirectory is limited to MAX_PATH, and merely used it as 'quick fix' since I didn't
know whether or not the change was intentional (or permanent). Knowing that it is, I can now do it properly
using the path prefix for files.
Post Reply

Return to “Plug-In Developers”