replace backslash to slash for file path

This commit is contained in:
Tanasart 2024-09-10 09:16:50 +07:00
parent 919111e377
commit 6581ae8e58
16 changed files with 45 additions and 39 deletions

View file

@ -15,7 +15,7 @@ event_inherited();
self.directory = directory;
var propPath = directory + "\\meta.json";
var propPath = directory + "/meta.json";
context_menus = {};
panels = {};
@ -51,7 +51,7 @@ event_inherited();
}
}
scriptPath = directory + "\\script.lua";
scriptPath = directory + "/script.lua";
if(!file_exists_empty(scriptPath)) {
noti_warning(title + " Addon error: script.lua not found.");
return self;

View file

@ -21,7 +21,7 @@
if(DIRECTORY != "") {
var _ch = string_char_last(DIRECTORY);
if(_ch != "\\" && _ch != "/") DIRECTORY += "\\";
if(_ch != "\\" && _ch != "/") DIRECTORY += "/";
show_debug_message($"Env directory: {DIRECTORY}");
var dir_valid = DIRECTORY != "" && directory_exists(DIRECTORY);
@ -42,13 +42,13 @@
} else
DIRECTORY = APP_DIRECTORY;
PREFERENCES_DIR = $"{DIRECTORY}Preferences\\{PREF_VERSION}\\";
PREFERENCES_DIR = $"{DIRECTORY}Preferences/{PREF_VERSION}/";
directory_verify(DIRECTORY);
APP_LOCATION = program_directory;
if(OS == os_macosx)
APP_LOCATION = string_replace(APP_LOCATION, "/Contents/MacOS/", "/Contents/Resources/");
if(string_pos("GameMakerStudio2\\Cache\\runtimes", APP_LOCATION))
if(string_pos("GameMakerStudio2/Cache/runtimes", APP_LOCATION))
APP_LOCATION = working_directory;
print($"===================== WORKING DIRECTORIES =====================\n\t{working_directory}\n\t{DIRECTORY}");
#endregion

View file

@ -14,13 +14,13 @@ function __initAddon() {
directory_verify(dirPath);
__addonDefault(dirPath);
var f = file_find_first(dirPath + "\\*", fa_directory);
var f = file_find_first(dirPath + "/*", fa_directory);
var _f = "";
while(f != "" && f != _f) {
_f = f;
var _path = dirPath + "\\" + f;
var _meta = _path + "\\meta.json";
var _path = dirPath + "/" + f;
var _meta = _path + "/meta.json";
if(!file_exists_empty(_meta)) {
f = file_find_next();
@ -44,7 +44,7 @@ function __initAddon() {
}
function loadAddon() {
var _path = DIRECTORY + "Addons\\__init.json";
var _path = DIRECTORY + "Addons/__init.json";
if(!file_exists_empty(_path)) return;
ADDONS_ON_START = json_load_struct(_path);

View file

@ -52,7 +52,7 @@ function __Node_3D_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constru
file_text_write_string(fObj, "vn " + string(v.normals[j][0]) + " " + string(v.normals[j][1]) + " " + string(v.normals[j][2]) + "\n");
var mtlName = "material_" + string(i);
var mtlPath = filename_dir(mPath) + "\\" + filename_name_only(oPath) + "_material_" + string(i) + ".png";
var mtlPath = filename_dir(mPath) + "/" + filename_name_only(oPath) + "_material_" + string(i) + ".png";
file_text_write_string(fObj, "\nusemtl " + mtlName + "\n");
file_text_write_string(fMtl, "newmtl " + mtlName + "\n");

View file

@ -64,7 +64,7 @@ function addonActivated(_addon) {
function addonLoad(_addon, _openDialog = true) {
var _name = filename_name_only(_addon);
var addonPath = DIRECTORY + "Addons\\" + _name;
var addonPath = DIRECTORY + "Addons/" + _name;
if(!directory_exists(addonPath)) return;
with(_addon_custom) if(name == _name) return;
@ -75,7 +75,7 @@ function addonLoad(_addon, _openDialog = true) {
function addonUnload(_addon) {
var _name = filename_name_only(_addon);
var addonPath = DIRECTORY + "Addons\\" + _name;
var addonPath = DIRECTORY + "Addons/" + _name;
if(!directory_exists(addonPath)) return;
with(_addon_custom) if(name == _name) instance_destroy();

View file

@ -127,7 +127,7 @@ function setException() {
} else
show_debug_message(tt);
var rep = $"{APP_LOCATION}report\\PXC crash reporter.exe";
var rep = $"{APP_LOCATION}report/PXC crash reporter.exe";
var pid = shell_execute(rep, DIRECTORY);
print($"{rep} [{file_exists(rep)}]: {pid}");

View file

@ -32,7 +32,7 @@ function Node_3D_Mesh_Export(_x, _y, _group = noone) : Node(_x, _y, _group) cons
var _vbs = _mesh.VB;
var _mtlPath = filename_dir(_path) + "\\" + filename_name_only(_path) + ".mtl";
var _mtlPath = filename_dir(_path) + "/" + filename_name_only(_path) + ".mtl";
var _mtlName = filename_name(_mtlPath);
var _mtl = "# Pixel Composer\n";
var _obj = "# Pixel Composer\n";
@ -55,7 +55,7 @@ function Node_3D_Mesh_Export(_x, _y, _group = noone) : Node(_x, _y, _group) cons
_obj += $"usemtl {_matName}\n";
if(is_surface(_material.surface)) {
var _surfPath = $"{filename_dir(_path)}\\{filename_name_only(_path)}_texture{i}.png";
var _surfPath = $"{filename_dir(_path)}/{filename_name_only(_path)}_texture{i}.png";
surface_save(_material.surface, _surfPath);
_mtl += $"map_Kd {_surfPath}\n";
}

View file

@ -103,7 +103,7 @@ function Panel_Addon() : PanelContent() constructor {
array_remove(ADDONS_ON_START, _addon.name);
}
json_save_struct(DIRECTORY + "Addons\\__init.json", ADDONS_ON_START);
json_save_struct(DIRECTORY + "Addons/__init.json", ADDONS_ON_START);
}
} else
draw_sprite_stretched_ext(THEME.checkbox_def, 0, chx0, chy0, ui(28), ui(28), c_white, 1);
@ -118,7 +118,7 @@ function Panel_Addon() : PanelContent() constructor {
var b = buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pFOCUS, pHOVER, __txt("Open in explorer"), THEME.folder_content);
if(b) hover = false;
if(b == 2) shellOpenExplorer(DIRECTORY + "Addons\\" + _addon.name);
if(b == 2) shellOpenExplorer(DIRECTORY + "Addons/" + _addon.name);
_bx -= ui(36)
if(_act && buttonInstant(THEME.button_hide, _bx, _by, ui(32), ui(32), _m, pFOCUS, pHOVER, __txt("Addon settings"), THEME.addon_setting) == 2) {

View file

@ -85,9 +85,9 @@ function ExpDir(path) : ExpFile(path) constructor {
if(!directory_exists(path)) return;
var f = file_find_first(path + "\\*", fa_directory);
var f = file_find_first(path + "/*", fa_directory);
while (f != "") {
var _fp = $"{path}\\{f}";
var _fp = $"{path}/{f}";
if(directory_exists(_fp)) {
var _fileObj = ExpCreateFile(_fp);
_fileObj.parent = self;
@ -97,9 +97,9 @@ function ExpDir(path) : ExpFile(path) constructor {
}
file_find_close();
var f = file_find_first(path + "\\*", fa_none);
var f = file_find_first(path + "/*", fa_none);
while (f != "") {
var _fp = $"{path}\\{f}";
var _fp = $"{path}/{f}";
if(file_exists(_fp) && !directory_exists(_fp)) {
var _fileObj = ExpCreateFile(_fp);
_fileObj.parent = self;

View file

@ -3,7 +3,7 @@ function Panel_Test() : PanelContent() constructor {
h = ui(160);
title = "Tester";
test_dir = "D:\\Project\\MakhamDev\\LTS-PixelComposer\\TEST";
test_dir = "D:/Project/MakhamDev/LTS-PixelComposer/TEST";
tb_test_dir = new textBox(TEXTBOX_INPUT.text, function(txt) { test_dir = txt; });
tb_index = new textBox(TEXTBOX_INPUT.number, function(txt) { start_index = txt; });
tb_amount = new textBox(TEXTBOX_INPUT.number, function(txt) { test_amount = txt; });
@ -17,20 +17,20 @@ function Panel_Test() : PanelContent() constructor {
test_button_surface = surface_create(1, 1);
function scanDir(dir) {
var f = file_find_first(dir + "\\*", fa_none);
var f = file_find_first(dir + "/*", fa_none);
while(f != "") {
var path = dir + "\\" + f;
var path = dir + "/" + f;
if(filename_ext_raw(path) == "pxc")
array_push(test_files, path);
f = file_find_next();
}
file_find_close();
var f = file_find_first(dir + "\\*", fa_directory);
var f = file_find_first(dir + "/*", fa_directory);
var _dir = [];
while(f != "") {
var path = dir + "\\" + f;
var path = dir + "/" + f;
array_push(_dir, path);
f = file_find_next();
}

View file

@ -283,7 +283,7 @@
if(IS_CMD) return;
directory_verify($"{DIRECTORY}Preferences");
directory_verify($"{DIRECTORY}Preferences\\{PREF_VERSION}");
directory_verify($"{DIRECTORY}Preferences/{PREF_VERSION}");
PREFERENCES.window_maximize = window_is_maximized;
PREFERENCES.window_width = max(960, window_minimize_size[0]);

View file

@ -46,7 +46,7 @@ function shell_execute_async(path, command, ref = noone, _log = true) { #region
function env_user() { #region
INLINE
if(OS == os_windows) return string(environment_get_variable("userprofile")) + "\\AppData\\Local\\PixelComposer\\";
if(OS == os_windows) return string(environment_get_variable("userprofile")) + "/AppData/Local/PixelComposer/";
if(OS == os_macosx) return string(environment_get_variable("HOME")) + "/PixelComposer/";
return "";
} #endregion

View file

@ -1,8 +1,9 @@
#define CURVE_MAX 512
#define MAX_POINTS 256
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define MAX_POINTS 256
uniform vec2 dimension;
uniform int sampleMode;
@ -12,7 +13,7 @@ uniform float points_x[MAX_POINTS];
uniform float points_y[MAX_POINTS];
uniform float intensity;
uniform float i_curve[1024];
uniform float i_curve[CURVE_MAX];
uniform int i_amount;
vec4 sample(vec2 pos) { #region
@ -88,7 +89,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[1024] curve, in int amo, in float _x) {
float curveEval(in float[CURVE_MAX] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -1,13 +1,15 @@
#define CURVE_MAX 512
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float h_curve[1024];
uniform float h_curve[CURVE_MAX];
uniform int h_amount;
uniform float s_curve[1024];
uniform float s_curve[CURVE_MAX];
uniform int s_amount;
uniform float v_curve[1024];
uniform float v_curve[CURVE_MAX];
uniform int v_amount;
float eval_curve_segment_t(in float _y0, in float ax0, in float ay0, in float bx1, in float by1, in float _y1, in float prog) {
@ -64,7 +66,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[1024] curve, in int amo, in float _x) {
float curveEval(in float[CURVE_MAX] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;

View file

@ -1,3 +1,5 @@
#define CURVE_MAX 512
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -7,7 +9,7 @@ uniform float dist;
uniform int useMap;
uniform sampler2D strengthMap;
uniform float alpha_curve[1024];
uniform float alpha_curve[CURVE_MAX];
uniform int curve_amount;
uniform float randomAmount;

View file

@ -1,4 +1,5 @@
// 2D Signed Distance equations by InigoQuilez
#define CURVE_MAX 512
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -12,7 +13,7 @@ uniform int tile;
uniform int drawBG;
uniform int drawDF;
uniform vec2 dfLevel;
uniform float w_curve[1024];
uniform float w_curve[CURVE_MAX];
uniform int w_amount;
uniform float rotation;
@ -106,7 +107,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
}
float curveEval(in float[1024] curve, in int amo, in float _x) {
float curveEval(in float[CURVE_MAX] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1;