Browse Source

Fix extension handling to work with the V2 SDK.

pull/62/head
Sean Lee 3 years ago
parent
commit
7a3d948d9c
9 changed files with 16 additions and 16 deletions
  1. +1
    -1
      src/DuktapeEngine.cpp
  2. +1
    -1
      src/FaustEngine.cpp
  3. +1
    -1
      src/LibPDEngine.cpp
  4. +1
    -1
      src/LuaJITEngine.cpp
  5. +7
    -7
      src/Prototype.cpp
  6. +1
    -1
      src/PythonEngine.cpp
  7. +1
    -1
      src/QuickJSEngine.cpp
  8. +2
    -2
      src/SuperColliderEngine.cpp
  9. +1
    -1
      src/VultEngine.cpp

+ 1
- 1
src/DuktapeEngine.cpp View File

@@ -219,5 +219,5 @@ struct DuktapeEngine : ScriptEngine {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<DuktapeEngine>("js");
addScriptEngine<DuktapeEngine>(".js");
}

+ 1
- 1
src/FaustEngine.cpp View File

@@ -369,5 +369,5 @@ private:

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<FaustEngine>("dsp");
addScriptEngine<FaustEngine>(".dsp");
}

+ 1
- 1
src/LibPDEngine.cpp View File

@@ -331,5 +331,5 @@ void LibPDEngine::sendInitialStates(const ProcessBlock* block) {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<LibPDEngine>("pd");
addScriptEngine<LibPDEngine>(".pd");
}

+ 1
- 1
src/LuaJITEngine.cpp View File

@@ -246,5 +246,5 @@ struct LuaJITEngine : ScriptEngine {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<LuaJITEngine>("lua");
addScriptEngine<LuaJITEngine>(".lua");
}

+ 7
- 7
src/Prototype.cpp View File

@@ -334,7 +334,7 @@ struct Prototype : Module {
std::string extension = system::getExtension(path);
scriptEngine = createScriptEngine(extension);
if (!scriptEngine) {
message = string::f("No engine for .%s extension", extension.c_str());
message = string::f("No engine for %s extension", extension.c_str());
return;
}
scriptEngine->module = this;
@@ -406,13 +406,13 @@ struct Prototype : Module {
}

void newScriptDialog() {
std::string ext = "js";
std::string ext = ".js";
// Get current extension if a script is currently loaded
if (!path.empty()) {
ext = system::getExtension(path);
}
std::string dir = asset::plugin(pluginInstance, "examples");
std::string filename = "Untitled." + ext;
std::string filename = "Untitled" + ext;
char* newPathC = osdialog_file(OSDIALOG_SAVE, dir.c_str(), filename.c_str(), NULL);
if (!newPathC) {
return;
@@ -436,7 +436,7 @@ struct Prototype : Module {
}

// Copy template to new script
std::string templatePath = asset::plugin(pluginInstance, "examples/template." + ext);
std::string templatePath = asset::plugin(pluginInstance, "examples/template" + ext);
{
std::ifstream templateFile(templatePath, std::ios::binary);
std::ofstream newFile(newPath, std::ios::binary);
@@ -468,7 +468,7 @@ struct Prototype : Module {

std::string ext = system::getExtension(path);
std::string dir = asset::plugin(pluginInstance, "examples");
std::string filename = "Untitled." + ext;
std::string filename = "Untitled" + ext;
char* newPathC = osdialog_file(OSDIALOG_SAVE, dir.c_str(), filename.c_str(), NULL);
if (!newPathC) {
return;
@@ -478,7 +478,7 @@ struct Prototype : Module {
// Add extension if user didn't specify one
std::string newExt = system::getExtension(newPath);
if (newExt == "")
newPath += "." + ext;
newPath += ext;

// Write and close file
{
@@ -594,7 +594,7 @@ struct Prototype : Module {
if (path == "")
return "";
// HACK check if extension is .pd
if (system::getExtension(path) == "pd")
if (system::getExtension(path) == ".pd")
return settingsPdEditorPath;
return settingsEditorPath;
}


+ 1
- 1
src/PythonEngine.cpp View File

@@ -252,5 +252,5 @@ struct PythonEngine : ScriptEngine {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<PythonEngine>("py");
addScriptEngine<PythonEngine>(".py");
}

+ 1
- 1
src/QuickJSEngine.cpp View File

@@ -329,5 +329,5 @@ struct QuickJSEngine : ScriptEngine {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<QuickJSEngine>("js");
addScriptEngine<QuickJSEngine>(".js");
}

+ 2
- 2
src/SuperColliderEngine.cpp View File

@@ -405,6 +405,6 @@ bool SC_VcvPrototypeClient::copyArrayOfFloatArrays(const PyrSlot& inSlot, const

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<SuperColliderEngine>("sc");
addScriptEngine<SuperColliderEngine>("scd");
addScriptEngine<SuperColliderEngine>(".sc");
addScriptEngine<SuperColliderEngine>(".scd");
}

+ 1
- 1
src/VultEngine.cpp View File

@@ -150,5 +150,5 @@ struct VultEngine : ScriptEngine {

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<VultEngine>("vult");
addScriptEngine<VultEngine>(".vult");
}

Loading…
Cancel
Save