[ZeroBrane Studio] Re: Implement "Add Specific File Type" right-click menu option

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Fri, 13 Feb 2015 09:31:23 -0800

Hi Jan,

> They way I am getting this folder at the moment is iterating over file
tree parents until I find the upmost and use its text as the path. That
works, but seems REAAAAALLLY hacky. Is there a less hacky way to receive
the current project path?

Sure, there is ide:GetProject() call that returns you the current project.
All the methods in package.lua are available for packages/plugins.

If you are working with the Filetree, there are also several methods that
may help with what you are doing; for example,
ide:GetProjectTree():GetItemFullName(item_id) will give you a full name
(including the project name) for the item with item_id.

Paul.

On Fri, Feb 13, 2015 at 2:38 AM, Jan Drabner <jan@xxxxxxxxxxx> wrote:

> Just wanted to give some feedback on this.
> Your suggestions worked out fine, I could implement what I had planned.
> Thanks!
>
> However, one thing bugs me a bit.
> I need to create the new file in a place within the current project
> folder. In another part, I need to replace the current project folder in a
> path with something else. Obviously, for all of that I need the current
> project folder.
>
> They way I am getting this folder at the moment is iterating over file
> tree parents until I find the upmost and use its text as the path. That
> works, but seems REAAAAALLLY hacky. Is there a less hacky way to receive
> the current project path?
>
>

Other related posts: