Author Topic: New project wizard - remove files from project  (Read 4624 times)

Offline oth_florian

  • Single posting newcomer
  • *
  • Posts: 5
New project wizard - remove files from project
« on: May 24, 2017, 09:09:45 am »
Hi guys,
I want to add a new project wizard. The basic things works, I have now a project wizard and all files in my "files" directory will be copied into the project directory (like I want). The problem is: I want to remove some files from the project after importing it. There is the function "GetFilesDir" which gives the directory of all files and add ALL these files to the project. But in my directory structure there are also some not to compile files (like examples). How can I remove these files in the squirrel script?

Thanks for help!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New project wizard - remove files from project
« Reply #1 on: May 24, 2017, 09:37:56 am »
The API docs are here: http://wiki.codeblocks.org/index.php/Scripting_commands
But I don't see anything useful there. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: New project wizard - remove files from project
« Reply #2 on: May 24, 2017, 09:40:00 am »

Offline oth_florian

  • Single posting newcomer
  • *
  • Posts: 5
Re: New project wizard - remove files from project
« Reply #3 on: May 24, 2017, 09:49:37 am »
http://wiki.codeblocks.org/index.php/Scripting_commands#IO_namespace
all functions to create and delete files?

I see the deleting files from disk functions. But is this removing the files also from project? At the end I want remove these files only from project, so the user using the wizard can look at the examples.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: New project wizard - remove files from project
« Reply #4 on: May 24, 2017, 10:00:10 am »
You can try ProjectFile::RemoveBuildTarget, but I'm not sure it will work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oth_florian

  • Single posting newcomer
  • *
  • Posts: 5
Re: New project wizard - remove files from project
« Reply #5 on: May 24, 2017, 10:09:35 am »
You can try ProjectFile::RemoveBuildTarget, but I'm not sure it will work.

I tried it ;) And it does not work, I have no idea for what this is...
But I have a solution which work for me:

Code
		
if ((project.GetFile(i).relativeFilename.Matches(_T("FatFS/doc*"))) || (project.GetFile(i).relativeFilename.Matches(_T("FatFS/src/option*"))))
{
project.GetFile(i).compile = false;
project.GetFile(i).link = false;
}
I do it like this and it compiles and links...
The documentation is not very helpful...

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: New project wizard - remove files from project
« Reply #6 on: May 24, 2017, 04:03:21 pm »
The documentation is not very helpful...

any more complaining on this so we can fix it? ;)

Offline oth_florian

  • Single posting newcomer
  • *
  • Posts: 5
Re: New project wizard - remove files from project
« Reply #7 on: May 26, 2017, 05:40:58 pm »
The documentation is not very helpful...

any more complaining on this so we can fix it? ;)

I mean this site
http://wiki.codeblocks.org/index.php/Scripting_commands

But at the moment I don't know how to the things better, but examples always help.
How can I contribute to the documentation?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: New project wizard - remove files from project
« Reply #8 on: May 26, 2017, 05:42:45 pm »
The forum log in should be the same as on the wiki. If not, you may have to send a pm to jens so he can add you to the wiki user list

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: New project wizard - remove files from project
« Reply #9 on: May 26, 2017, 10:10:06 pm »
Just to come back to your question: You want to remove files from the codeblocks project?
Why do you don't use the function cbProject::RemoveFile function?
You can iterate through the project file and check the relative filename and remove the wrong files....

Or do you want only to not compile this files, but still let them in the project? If that is what you want, i think you can set ProjectFile::compile to false