delete project.topNode.files;
if(!project.files) project.files = { };
project.topNode.files = project.files;
+
+ {
+ char topNodePath[MAX_LOCATION];
+ GetWorkingDir(topNodePath, sizeof(topNodePath)-1);
+ MakeSlashPath(topNodePath);
+ PathCatSlash(topNodePath, filePath);
+ project.filePath = topNodePath;//filePath;
+ }
+
+ project.topNode.FixupNode(insidePath);
+
project.resNode = project.topNode.Add(project, "Resources", project.topNode.files.last, resources, archiveFile, false);
delete project.resNode.path;
project.resNode.path = project.resourcesPath;
project.resources = null;
if(!project.configurations) project.configurations = { };
- {
- char topNodePath[MAX_LOCATION];
- GetWorkingDir(topNodePath, sizeof(topNodePath)-1);
- MakeSlashPath(topNodePath);
- PathCatSlash(topNodePath, filePath);
- project.filePath = topNodePath;//filePath;
- }
-
- project.topNode.FixupNode(insidePath);
+ project.resNode.FixupNode(insidePath);
}
delete parser;
}
ProjectNode FindByFullPath(char * path, bool includeResources)
{
+ if(files)
+ {
+ char name[MAX_FILENAME];
+ GetLastDirectory(path, name);
+ return InternalFindByFullPath(path, includeResources, name);
+ }
+ return null;
+ }
+
+ ProjectNode InternalFindByFullPath(char * path, bool includeResources, char * lastDirName)
+ {
ProjectNode result = null;
if(files)
{
{
if(includeResources || child.type != resources)
{
- if(child.type != folder && child.name)
+ if(child.type != file)
+ result = child.InternalFindByFullPath(path, includeResources, lastDirName);
+ else if(child.name && !strcmpi(lastDirName, child.name))
{
char p[MAX_LOCATION];
child.GetFullFilePath(p);
break;
}
}
- result = child.FindByFullPath(path, includeResources);
if(result)
break;
}
ProjectNode Add(Project project, char * filePath, ProjectNode after, NodeTypes type, NodeIcons icon, bool checkIfExists)
{
ProjectNode node = null;
- char temp[MAX_LOCATION];
- Map<Platform, SetBool> exclusionInfo { };
-
- GetLastDirectory(filePath, temp);
- //if(!checkIfExists || !project.topNode.Find(temp, false))
-
- // TOCHECK: Shouldn't this apply either for all configs or none?
- CollectExclusionInfo(exclusionInfo, project.config);
- if(!checkIfExists || !project.topNode.FindSameNameConflict(temp, false, exclusionInfo, project.config))
+ if(!project.topNode.FindByFullPath(filePath, true))
{
- // Do the check for folder in the same parent or resource files only here
- if(type == folder || !checkIfExists)
+ char temp[MAX_LOCATION];
+ Map<Platform, SetBool> exclusionInfo { };
+
+ GetLastDirectory(filePath, temp);
+ //if(!checkIfExists || !project.topNode.Find(temp, false))
+
+ // TOCHECK: Shouldn't this apply either for all configs or none?
+ CollectExclusionInfo(exclusionInfo, project.config);
+ if(!checkIfExists || !project.topNode.FindSameNameConflict(temp, false, exclusionInfo, project.config))
{
- for(node : files)
+ // Do the check for folder in the same parent or resource files only here
+ if(type == folder || !checkIfExists)
{
- if(node.name && !strcmpi(node.name, temp))
- return null;
+ for(node : files)
+ {
+ if(node.name && !strcmpi(node.name, temp))
+ return null;
+ }
}
- }
- node = ProjectNode { parent = this, indent = indent + 1, type = type, icon = icon, name = CopyString(temp) };
- if(type != file)
- {
- node.files = { };
- node.nodeType = folder;
- }
- if(type != folder)
- {
- if(filePath)
+ node = ProjectNode { parent = this, indent = indent + 1, type = type, icon = icon, name = CopyString(temp) };
+ if(type != file)
{
- StripLastDirectory(filePath, temp);
- MakePathRelative(temp, project.topNode.path, temp);
- node.path = CopyUnixPath(temp);
+ node.files = { };
+ node.nodeType = folder;
}
- node.nodeType = file;
- }
- else
- {
- strcpy(temp, (type == NodeTypes::project) ? "" : path);
- PathCatSlash(temp, node.name);
- node.path = CopyString(temp);
+ if(type != folder)
+ {
+ if(filePath)
+ {
+ StripLastDirectory(filePath, temp);
+ MakePathRelative(temp, project.topNode.path, temp);
+ node.path = CopyUnixPath(temp);
+ }
+ node.nodeType = file;
+ }
+ else
+ {
+ strcpy(temp, (type == NodeTypes::project) ? "" : path);
+ PathCatSlash(temp, node.name);
+ node.path = CopyString(temp);
+ }
+ files.Insert(after, node);
}
- files.Insert(after, node);
+ delete exclusionInfo;
}
- delete exclusionInfo;
return node;
}