Page 1 of 1

Is it possible to write to project file with external tool?

Posted: Tue Sep 08, 2015 9:03 pm
by helpy
Hello,

probably this can only be answered by Purebasic team:

An external tool can get full path and filename of currently loaded project file with the environment variable PB_TOOL_Project.
Is it possible to change the project file with external tool?

I want to save own project specific information inside the pbp file, similar to the following code:

Code: Select all

<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 5.40 LTS Beta 3 (Windows - x64)">
  <section name="config">
    <options closefiles="1" openmode="2" name="project-name"/>
  </section>
  ...
  <section name="externalTool:information">
    ...
  </section>
</project>
Does the IDE allow this?

Thank you for the information,
guido

Re: Is it possible to write to project file with external to

Posted: Wed Sep 09, 2015 10:13 pm
by helpy
OK!

I tested it myself.
It is possible to write own data to pbp file, but it will be overwritten with the pbp contents, which was already loaded by the IDE, after closing the project or exiting the IDE.

This means: it is not possible to use the pbp file to save own project specific data.

Re: Is it possible to write to project file with external to

Posted: Thu Sep 10, 2015 8:04 am
by c4s
I think a workaround might be to put your data into the project's comment section ("Project Options" -> "Comments").

Re: Is it possible to write to project file with external to

Posted: Thu Sep 10, 2015 9:14 am
by helpy
c4s wrote:I think a workaround might be to put your data into the project's comment section ("Project Options" -> "Comments").
Thank you for your hint.

I was searching a way to add user specific project options to pbp file with an "external IDE Tool" (Tools -> Configure Tools...)!
I do not want to write it by my own in to the comment section!

I think the best way is to create a new file for my user specific project settings based on the project file name!
==> project file: /path/to/project/file/project.pbp
==> user specific project file: /path/to/project/file/project.pbp.user

Re: Is it possible to write to project file with external to

Posted: Thu Sep 10, 2015 10:02 am
by c4s
helpy wrote:I was searching a way to add user specific project options to pbp file with an "external IDE Tool" (Tools -> Configure Tools...)!
I do not want to write it by my own in to the comment section!
That's what I meant. Isn't it possible to write into the comment section of the project file after the file has been updated by the IDE?

Re: Is it possible to write to project file with external to

Posted: Thu Sep 10, 2015 10:48 am
by helpy
c4s wrote:
helpy wrote:I was searching a way to add user specific project options to pbp file with an "external IDE Tool" (Tools -> Configure Tools...)!
I do not want to write it by my own in to the comment section!
That's what I meant. Isn't it possible to write into the comment section of the project file after the file has been updated by the IDE?
I was writing to the xml file (created a complete new section there).
==> If the project is closed or the IDE is closed, the IDE overwrites the pbp with its own preloaded version!

The same would happen if i write the comment in to the pbp file!

But I think that the other option with an seperate "user project file" is the best way for now.