mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-20 18:22:02 +00:00
Added new script search paths
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@19809 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2e7e5f3d37
commit
e9767d770e
3 changed files with 65 additions and 22 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004 Aug 2 Stefan Urbanek
|
||||||
|
|
||||||
|
* Search for scripts in */Library/Scripts/*
|
||||||
|
* stexec: use scripts manager to look for scripts in default locations. For
|
||||||
|
this tool it is .../Library/Scripts/Shell or .../Library/StepTalk/Scripts/Shell
|
||||||
|
|
||||||
|
2004 Jul 26 Stefan Urbanek
|
||||||
|
|
||||||
|
* Added NSString containsString: to Foundation module.
|
||||||
|
|
||||||
2004 Jun 27 Stefan Urbanek
|
2004 Jun 27 Stefan Urbanek
|
||||||
|
|
||||||
* Added examples:
|
* Added examples:
|
||||||
|
|
|
@ -136,6 +136,20 @@ process name.*/
|
||||||
[scriptPaths addObject:str];
|
[scriptPaths addObject:str];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add same, but without StepTalk (only Library/Scripts) */
|
||||||
|
enumerator = [paths objectEnumerator];
|
||||||
|
|
||||||
|
while( (path = [enumerator nextObject]) )
|
||||||
|
{
|
||||||
|
path = [path stringByAppendingPathComponent:@"Scripts"];
|
||||||
|
|
||||||
|
str = [path stringByAppendingPathComponent: scriptsDomainName];
|
||||||
|
[scriptPaths addObject:str];
|
||||||
|
|
||||||
|
str = [path stringByAppendingPathComponent:@"Shared"];
|
||||||
|
[scriptPaths addObject:str];
|
||||||
|
}
|
||||||
|
|
||||||
enumerator = [[NSBundle allBundles] objectEnumerator];
|
enumerator = [[NSBundle allBundles] objectEnumerator];
|
||||||
|
|
||||||
while( (bundle = [enumerator nextObject]) )
|
while( (bundle = [enumerator nextObject]) )
|
||||||
|
@ -191,6 +205,7 @@ process name.*/
|
||||||
{
|
{
|
||||||
if( [manager fileExistsAtPath:path isDirectory:&isDir] && isDir )
|
if( [manager fileExistsAtPath:path isDirectory:&isDir] && isDir )
|
||||||
{
|
{
|
||||||
|
// NSLog(@"VARLIOD %@", path);
|
||||||
[scriptPaths addObject:path];
|
[scriptPaths addObject:path];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,6 +232,7 @@ process name.*/
|
||||||
|
|
||||||
while( (path = [pEnumerator nextObject]) )
|
while( (path = [pEnumerator nextObject]) )
|
||||||
{
|
{
|
||||||
|
// NSLog(@"IN %@", path);
|
||||||
sEnumerator = [[manager directoryContentsAtPath:path] objectEnumerator];
|
sEnumerator = [[manager directoryContentsAtPath:path] objectEnumerator];
|
||||||
|
|
||||||
while( (file = [sEnumerator nextObject]) )
|
while( (file = [sEnumerator nextObject]) )
|
||||||
|
|
|
@ -116,16 +116,17 @@ const char *STExecutorCommonOptions =
|
||||||
NSFileManager *manager = [NSFileManager defaultManager];
|
NSFileManager *manager = [NSFileManager defaultManager];
|
||||||
STEnvironment *env;
|
STEnvironment *env;
|
||||||
NSString *convLanguageName;
|
NSString *convLanguageName;
|
||||||
|
NSString *source;
|
||||||
|
|
||||||
if( [manager fileExistsAtPath:file isDirectory:NO] )
|
if( [manager fileExistsAtPath:file isDirectory:NO] )
|
||||||
{
|
{
|
||||||
NSString *source = [NSString stringWithContentsOfFile:file];
|
source = [NSString stringWithContentsOfFile:file];
|
||||||
|
|
||||||
if(langName)
|
if(langName)
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Using language %@", langName);
|
NSDebugLog(@"Using language %@", langName);
|
||||||
|
|
||||||
[conversation setLanguage:langName];
|
convLanguageName = langName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -133,13 +134,35 @@ const char *STExecutorCommonOptions =
|
||||||
[file pathExtension]);
|
[file pathExtension]);
|
||||||
|
|
||||||
convLanguageName = [STLanguage languageNameForFileType:[file pathExtension]];
|
convLanguageName = [STLanguage languageNameForFileType:[file pathExtension]];
|
||||||
[conversation setLanguage:convLanguageName];
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
STScriptsManager *sm;
|
||||||
|
STFileScript *script;
|
||||||
|
|
||||||
|
/* Try to find it in standard script locations */
|
||||||
|
sm = [[STScriptsManager alloc] initWithDomainName:@"Shell"];
|
||||||
|
|
||||||
|
script = [sm scriptWithName:file];
|
||||||
|
source = [script source];
|
||||||
|
if(!source)
|
||||||
|
{
|
||||||
|
[NSException raise:STExecutorException
|
||||||
|
format:@"Could not find script '%@'", file];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
convLanguageName = [script language];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[conversation setLanguage:convLanguageName];
|
||||||
|
|
||||||
if(conversation)
|
if(conversation)
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Executing file '%@'",file);
|
NSDebugLog(@"Executing script '%@'",file);
|
||||||
|
|
||||||
env = [conversation environment];
|
env = [conversation environment];
|
||||||
[env setObject:args forName:@"Args"];
|
[env setObject:args forName:@"Args"];
|
||||||
|
@ -154,12 +177,6 @@ const char *STExecutorCommonOptions =
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
[NSException raise:STExecutorException
|
|
||||||
format:@"Could not find script '%@'", file];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)listLanguages
|
- (void)listLanguages
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue