Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: oth_florian on May 24, 2017, 09:09:45 am

Title: New project wizard - remove files from project
Post by: oth_florian 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!
Title: Re: New project wizard - remove files from project
Post by: oBFusCATed 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. :(
Title: Re: New project wizard - remove files from project
Post by: 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?
Title: Re: New project wizard - remove files from project
Post by: oth_florian 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.
Title: Re: New project wizard - remove files from project
Post by: oBFusCATed on May 24, 2017, 10:00:10 am
You can try ProjectFile::RemoveBuildTarget, but I'm not sure it will work.
Title: Re: New project wizard - remove files from project
Post by: oth_florian 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...
Title: Re: New project wizard - remove files from project
Post by: BlueHazzard on May 24, 2017, 04:03:21 pm
The documentation is not very helpful...

any more complaining on this so we can fix it? ;)
Title: Re: New project wizard - remove files from project
Post by: oth_florian 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 (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?
Title: Re: New project wizard - remove files from project
Post by: BlueHazzard 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
Title: Re: New project wizard - remove files from project
Post by: BlueHazzard 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