Handle source files being deleted.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2011-04-18 10:36:56 +02:00
committed by Klaas Pieter Annema
parent d5355df61c
commit 35bbb1a3d5
3 changed files with 16 additions and 16 deletions
+2 -10
View File
@@ -6,7 +6,7 @@ var FILE = require("file");
function main(args)
{
var fileURL = new CFURL(args[1]),
sourcesURL = new CFURL(args[2]),
outputURL = new CFURL(args[2]),
source = FILE.read(fileURL, { charset: "UTF-8" }),
flags = ObjectiveJ.Preprocessor.Flags.IncludeDebugSymbols |
ObjectiveJ.Preprocessor.Flags.IncludeTypeSignatures,
@@ -94,15 +94,7 @@ function main(args)
});
if (ObjectiveCSource.length)
FILE.write(FILE.join(sourcesURL, xCodeSupportShadowURL(fileURL)), ObjectiveCSource, { charset:"UTF-8" });
}
function xCodeSupportShadowURL(aURL)
{
var flattenedPath = (aURL + "").replace(/\//g, "_"),
extension = FILE.extension(flattenedPath);
return new CFURL(flattenedPath.substr(0, flattenedPath.length - extension.length) + ".h");
FILE.write(outputURL, ObjectiveCSource, { charset:"UTF-8" });
}
function NSCompatibleClassName(aClassName, asPointer)
+12 -4
View File
@@ -99,6 +99,15 @@ var FILE = require("file"),
[self updateNibFiles];
}
- (CPURL)shadowURLForSourceURL:(CPURL)aSourceURL
{
var flattenedPath = (aSourceURL + "").replace(new RegExp("\/", "g"), "_"),
extension = FILE.extension(flattenedPath),
basename = flattenedPath.substr(0, flattenedPath.length - extension.length) + ".h";
return new CFURL(basename, m_xCodeSupportSourcesURL.asDirectoryPathURL());
}
- (void)updateSourceFiles
{
// Require the new parser for this.
@@ -107,20 +116,19 @@ var FILE = require("file"),
[m_sourceResourceMonitor addedFilePaths].forEach(function(aFilePath)
{
print("Added " + aFilePath);
OS.system("objj " + [self xCodeProjectParserURL] + " " + aFilePath + " " + m_xCodeSupportSourcesURL);
OS.system("objj " + [self xCodeProjectParserURL] + " " + aFilePath + " " + [self shadowURLForSourceURL:aFilePath]);
});
[m_sourceResourceMonitor editedFilePaths].forEach(function(aFilePath)
{
print("Edited " + aFilePath);
OS.system("objj " + [self xCodeProjectParserURL] + " " + aFilePath + " " + m_xCodeSupportSourcesURL);
OS.system("objj " + [self xCodeProjectParserURL] + " " + aFilePath + " " + [self shadowURLForSourceURL:aFilePath]);
});
[m_sourceResourceMonitor removedFilePaths].forEach(function(aFilePath)
{
// delete?
print("Removed " + aFilePath);
// OS.system("nib2cib " + aFilePath);
FILE.remove([self shadowURLForSourceURL:aFilePath]);
});
}
+2 -2
View File
@@ -51,8 +51,8 @@ var FILE = require("file"),
var filePath = nil,
filePaths = [m_mtimesForFilePaths keyEnumerator];
while (filePath = [filePath nextObject])
if (![mtimesForFilePaths objectForKey:filePath] === nil)
while (filePath = [filePaths nextObject])
if ([mtimesForFilePaths objectForKey:filePath] === nil)
[m_removedFilePaths addObject:filePath];
m_mtimesForFilePaths = mtimesForFilePaths;