News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

New project wizard - remove files from project

Started by oth_florian, May 24, 2017, 09:09:45 AM

Previous topic - Next topic

oth_florian

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!

oBFusCATed

(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!]

BlueHazzard


oth_florian

Quote from: BlueHazzard on May 24, 2017, 09:40:00 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.

oBFusCATed

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!]

oth_florian

Quote from: oBFusCATed on May 24, 2017, 10:00:10 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:


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...

BlueHazzard

Quote from: oth_florian on May 24, 2017, 10:09:35 AM
The documentation is not very helpful...

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

oth_florian

Quote from: BlueHazzard on May 24, 2017, 04:03:21 PM
Quote from: oth_florian on May 24, 2017, 10:09:35 AM
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?

BlueHazzard

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

BlueHazzard

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