mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Introjucer: prevented copying hidden source-control sub-folders when module code is copied to the project folder.
This commit is contained in:
parent
426c8fad0b
commit
4ed044b93c
1 changed files with 19 additions and 7 deletions
|
|
@ -176,6 +176,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool shouldFolderBeIgnoredWhenCopying (const File& f)
|
||||
{
|
||||
return f.getFileName() == ".git" || f.getFileName() == ".svn" || f.getFileName() == ".cvs";
|
||||
}
|
||||
|
||||
bool copyFolder (const File& source, const File& dest)
|
||||
{
|
||||
if (source.isDirectory() && dest.createDirectory())
|
||||
|
|
@ -185,18 +190,25 @@ public:
|
|||
|
||||
for (int i = 0; i < subFiles.size(); ++i)
|
||||
{
|
||||
const File target (dest.getChildFile (subFiles.getReference(i).getFileName()));
|
||||
const File f (subFiles.getReference(i));
|
||||
const File target (dest.getChildFile (f.getFileName()));
|
||||
filesCreated.add (target);
|
||||
if (! subFiles.getReference(i).copyFileTo (target))
|
||||
|
||||
if (! f.copyFileTo (target))
|
||||
return false;
|
||||
}
|
||||
|
||||
subFiles.clear();
|
||||
source.findChildFiles (subFiles, File::findDirectories, false);
|
||||
Array<File> subFolders;
|
||||
source.findChildFiles (subFolders, File::findDirectories, false);
|
||||
|
||||
for (int i = 0; i < subFiles.size(); ++i)
|
||||
if (! copyFolder (subFiles.getReference(i), dest.getChildFile (subFiles.getReference(i).getFileName())))
|
||||
return false;
|
||||
for (int i = 0; i < subFolders.size(); ++i)
|
||||
{
|
||||
const File f (subFolders.getReference(i));
|
||||
|
||||
if (! shouldFolderBeIgnoredWhenCopying (f))
|
||||
if (! copyFolder (f, dest.getChildFile (f.getFileName())))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue