Skip to content

Commit

Permalink
libcore: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 17, 2015
1 parent 31a1981 commit 5a26a04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions doomsday/sdk/libcore/src/scriptsys/bindings_core.cpp
Expand Up @@ -62,6 +62,11 @@ static Value *Function_String_Lower(Context &ctx, Function::ArgumentValues const
return new TextValue(ctx.instanceScope().asText().lower());
}

static Value *Function_Path_WithoutFileName(Context &, Function::ArgumentValues const &args)
{
return new TextValue(args.at(0)->asText().fileNamePath());
}

static Value *Function_Dictionary_Keys(Context &ctx, Function::ArgumentValues const &)
{
return ctx.instanceScope().as<DictionaryValue>().contentsAsArray(DictionaryValue::Keys);
Expand Down Expand Up @@ -170,6 +175,13 @@ void initCoreModule(Binder &binder, Record &coreModule)
<< DENG2_FUNC_NOARG(String_FileNameAndPathWithoutExtension, "fileNameAndPathWithoutExtension");
}

// Path
{
Record &path = coreModule.addRecord("Path");
binder.init(path)
<< DENG2_FUNC(Path_WithoutFileName, "withoutFileName", "path");
}

// File
{
Record &file = coreModule.addRecord("File");
Expand Down
11 changes: 0 additions & 11 deletions doomsday/sdk/libcore/src/scriptsys/scriptsystem.cpp
Expand Up @@ -36,11 +36,6 @@

namespace de {

static Value *Function_Path_WithoutFileName(Context &, Function::ArgumentValues const &args)
{
return new TextValue(args.at(0)->asText().fileNamePath());
}

static ScriptSystem *_scriptSystem = 0;

DENG2_PIMPL(ScriptSystem)
Expand All @@ -54,7 +49,6 @@ DENG2_PIMPL(ScriptSystem)
NativeModules nativeModules; // not owned
Record coreModule; // Script: built-in script classes and functions.
Record versionModule; // Version: information about the platform and build
Record pathModule; // Path: path manipulation routines (based on native classes Path, NativePath, String)

/// Resident modules.
typedef QMap<String, Module *> Modules; // owned
Expand Down Expand Up @@ -87,11 +81,6 @@ DENG2_PIMPL(ScriptSystem)
#endif
addNativeModule("Version", mod);
}

// Setup the Path module.
binder.init(pathModule)
<< DENG2_FUNC(Path_WithoutFileName, "withoutFileName", "path");
addNativeModule("Path", pathModule);
}

~Instance()
Expand Down

0 comments on commit 5a26a04

Please sign in to comment.