Browse Source

Fix changed Rack v2 API

v2
Andrew Belt 3 years ago
parent
commit
f693e76333
2 changed files with 13 additions and 12 deletions
  1. +2
    -2
      src/LibPDEngine.cpp
  2. +11
    -10
      src/Prototype.cpp

+ 2
- 2
src/LibPDEngine.cpp View File

@@ -88,8 +88,8 @@ struct LibPDEngine : ScriptEngine {


display(version); display(version);


std::string name = string::filename(path);
std::string dir = string::directory(path);
std::string name = system::getFilename(path);
std::string dir = system::getDirectory(path);
libpd_openfile(name.c_str(), dir.c_str()); libpd_openfile(name.c_str(), dir.c_str());


sendInitialStates(block); sendInitialStates(block);


+ 11
- 10
src/Prototype.cpp View File

@@ -287,7 +287,7 @@ struct Prototype : Module {
return; return;


// Watch file // Watch file
std::string dir = string::directory(path);
std::string dir = system::getDirectory(path);
efsw = efsw_create(false); efsw = efsw_create(false);
efsw_addwatch(efsw, dir.c_str(), watchCallback, false, this); efsw_addwatch(efsw, dir.c_str(), watchCallback, false, this);
efsw_watch(efsw); efsw_watch(efsw);
@@ -331,7 +331,7 @@ struct Prototype : Module {
this->script = script; this->script = script;


// Create script engine from path extension // Create script engine from path extension
std::string extension = string::filenameExtension(string::filename(path));
std::string extension = system::getExtension(path);
scriptEngine = createScriptEngine(extension); scriptEngine = createScriptEngine(extension);
if (!scriptEngine) { if (!scriptEngine) {
message = string::f("No engine for .%s extension", extension.c_str()); message = string::f("No engine for .%s extension", extension.c_str());
@@ -353,7 +353,7 @@ struct Prototype : Module {
Prototype* that = (Prototype*) param; Prototype* that = (Prototype*) param;
if (action == EFSW_ADD || action == EFSW_DELETE || action == EFSW_MODIFIED || action == EFSW_MOVED) { if (action == EFSW_ADD || action == EFSW_DELETE || action == EFSW_MODIFIED || action == EFSW_MOVED) {
// Check filename // Check filename
std::string pathFilename = string::filename(that->path);
std::string pathFilename = system::getFilename(that->path);
if (pathFilename == filename) { if (pathFilename == filename) {
that->loadPath(); that->loadPath();
} }
@@ -409,7 +409,7 @@ struct Prototype : Module {
std::string ext = "js"; std::string ext = "js";
// Get current extension if a script is currently loaded // Get current extension if a script is currently loaded
if (!path.empty()) { if (!path.empty()) {
ext = string::filenameExtension(string::filename(path));
ext = system::getExtension(path);
} }
std::string dir = asset::plugin(pluginInstance, "examples"); std::string dir = asset::plugin(pluginInstance, "examples");
std::string filename = "Untitled." + ext; std::string filename = "Untitled." + ext;
@@ -424,7 +424,7 @@ struct Prototype : Module {
setPath(""); setPath("");


// Get extension of requested filename // Get extension of requested filename
ext = string::filenameExtension(string::filename(newPath));
ext = system::getExtension(newPath);
if (ext == "") { if (ext == "") {
message = "File extension required"; message = "File extension required";
return; return;
@@ -466,7 +466,7 @@ struct Prototype : Module {
if (script == "") if (script == "")
return; return;


std::string ext = string::filenameExtension(string::filename(path));
std::string ext = system::getExtension(path);
std::string dir = asset::plugin(pluginInstance, "examples"); 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); char* newPathC = osdialog_file(OSDIALOG_SAVE, dir.c_str(), filename.c_str(), NULL);
@@ -476,7 +476,7 @@ struct Prototype : Module {
std::string newPath = newPathC; std::string newPath = newPathC;
std::free(newPathC); std::free(newPathC);
// Add extension if user didn't specify one // Add extension if user didn't specify one
std::string newExt = string::filenameExtension(string::filename(newPath));
std::string newExt = system::getExtension(newPath);
if (newExt == "") if (newExt == "")
newPath += "." + ext; newPath += "." + ext;


@@ -594,7 +594,7 @@ struct Prototype : Module {
if (path == "") if (path == "")
return ""; return "";
// HACK check if extension is .pd // HACK check if extension is .pd
if (string::filenameExtension(string::filename(path)) == "pd")
if (system::getExtension(path) == "pd")
return settingsPdEditorPath; return settingsPdEditorPath;
return settingsEditorPath; return settingsEditorPath;
} }
@@ -625,7 +625,7 @@ struct FileChoice : LedDisplayChoice {
text = "Script"; text = "Script";
text += ": "; text += ": ";
if (module && module->path != "") if (module && module->path != "")
text += string::filename(module->path);
text += system::getFilename(module->path);
else else
text += "(click to load)"; text += "(click to load)";
} }
@@ -646,7 +646,8 @@ struct MessageChoice : LedDisplayChoice {


void draw(const DrawArgs& args) override { void draw(const DrawArgs& args) override {
nvgScissor(args.vg, RECT_ARGS(args.clipBox)); nvgScissor(args.vg, RECT_ARGS(args.clipBox));
if (font->handle >= 0) {
std::shared_ptr<Font> font = APP->window->loadFont(fontPath);
if (font && font->handle >= 0) {
nvgFillColor(args.vg, color); nvgFillColor(args.vg, color);
nvgFontFaceId(args.vg, font->handle); nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, 0.0); nvgTextLetterSpacing(args.vg, 0.0);


Loading…
Cancel
Save