Fixed paths on other platforms

This commit is contained in:
2022-06-19 01:05:32 +02:00
parent 9db98a12b4
commit ade3cdd6fe
2 changed files with 11 additions and 2 deletions

View File

@@ -16,6 +16,14 @@ if(process.platform === "win32") {
platformFolder = "linux"; platformFolder = "linux";
} }
export function platformCharacter() {
let platformCharacterTEMP = "/";
if (process.platform === "win32") {
platformCharacterTEMP = "\\";
}
return platformCharacterTEMP;
}
export const blenderPath = path.join(appPath, "dependencies", platformFolder, "blender", "blender"); export const blenderPath = path.join(appPath, "dependencies", platformFolder, "blender", "blender");
export const templatePath = path.join(appPath, "dependencies", "template.blend"); export const templatePath = path.join(appPath, "dependencies", "template.blend");
export const blenderScriptPath = path.join(appPath, "dependencies", "blenderScript.py"); export const blenderScriptPath = path.join(appPath, "dependencies", "blenderScript.py");

View File

@@ -4,6 +4,7 @@ import { settingList, updateSettings } from "../settings";
import logger from "../logger"; import logger from "../logger";
import {blender, blenderCmd} from "../blender-controller"; import {blender, blenderCmd} from "../blender-controller";
import openFolder from "../openFolder"; import openFolder from "../openFolder";
import {platformCharacter} from "../paths";
function MainSide() { function MainSide() {
const [logs, setLogs] = useState(settingList.log); const [logs, setLogs] = useState(settingList.log);
@@ -22,12 +23,12 @@ function MainSide() {
const logListName:string[] = []; const logListName:string[] = [];
logList.forEach(log => { logList.forEach(log => {
logListName.push(log.split('\\')[log.split('\\').length - 1].split('/')[log.split('/').length - 1].replace(".csv", "")); logListName.push(log.split(platformCharacter())[log.split(platformCharacter()).length - 1].replace(".csv", ""));
}); });
setLogTable(logListName.map((log, index) => { setLogTable(logListName.map((log, index) => {
return <tr key={index}> return <tr key={index}>
<td id="logList-Name" title={logList[index]} onClick={() => openFolder(logList[index].substring(0, logList[index].lastIndexOf('\\')).substring(0, logList[index].lastIndexOf('/')))}>{index+1}. {log}</td> <td id="logList-Name" title={logList[index]} onClick={() => openFolder(logList[index].substring(0, logList[index].lastIndexOf(platformCharacter())))}>{index+1}. {log}</td>
<td><button className="listButton" onClick={() => { <td><button className="listButton" onClick={() => {
const newLogs = settingList.log.replace('"'+logList[index]+'"', ""); const newLogs = settingList.log.replace('"'+logList[index]+'"', "");
updateSettings({log:newLogs}); updateSettings({log:newLogs});