diff --git a/src/application/utils/conform-file-path.js b/src/application/utils/conform-file-path.js new file mode 100644 index 000000000..38dfde947 --- /dev/null +++ b/src/application/utils/conform-file-path.js @@ -0,0 +1,6 @@ +import path from "path"; + +export const conformFilePath = (filePath = "") => + filePath + .split(process.platform === "win32" ? path.posix.sep : path.win32.sep) + .join(path.sep); diff --git a/src/application/worker/store/modules/images.js b/src/application/worker/store/modules/images.js index cab4b4617..b3ca197e9 100644 --- a/src/application/worker/store/modules/images.js +++ b/src/application/worker/store/modules/images.js @@ -6,6 +6,7 @@ import Vue from "vue"; import { v4 as uuidv4 } from "uuid"; import store from "../"; +import { conformFilePath } from "../../../utils/conform-file-path"; const state = {}; @@ -19,7 +20,10 @@ const actions = { let joinedFilePath; try { - joinedFilePath = path.join(store.state.media.path, filePath); + joinedFilePath = path.join( + store.state.media.path, + conformFilePath(filePath) + ); } catch (e) { console.log(e); } diff --git a/src/application/worker/store/modules/videos.js b/src/application/worker/store/modules/videos.js index 076956938..8dfbcc87c 100644 --- a/src/application/worker/store/modules/videos.js +++ b/src/application/worker/store/modules/videos.js @@ -1,6 +1,8 @@ import Vue from "vue"; -import uuidv4 from "uuid/v4"; +import { v4 as uuidv4 } from "uuid"; +import path from "path"; import store from "../"; +import { conformFilePath } from "../../../utils/conform-file-path"; const state = {}; @@ -12,10 +14,13 @@ const actions = { createVideoFromPath({ rootState, commit }, textureDefinition) { const { id = uuidv4(), - options: { path } + options: { path: filePath } } = textureDefinition; - const url = `modv://${rootState.media.path}${path}`; + const url = `modv://${path.join( + rootState.media.path, + conformFilePath(filePath) + )}`; if (typeof window !== "undefined") { self.postMessage({ diff --git a/yarn.lock b/yarn.lock index 0eb57d673..3bb1fdaa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -502,6 +502,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.13.tgz#5b2dd21cae4a2c5145f1fbd8ca103f9313d3b7e4" integrity sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg== +"@babel/parser@^7.18.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.4.tgz#94003fdfc520bbe2875d4ae557b43ddb6d880f17" + integrity sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.0": version "7.16.2" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.2.tgz#2977fca9b212db153c195674e57cfab807733183" @@ -13814,7 +13819,7 @@ vue-template-babel-compiler@^2.0.0: "@babel/types" "^7.14.5" deepmerge "^4.2.2" -vue-template-compiler@2.7.14: +vue-template-compiler@^2.7.14: version "2.7.14" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz#4545b7dfb88090744c1577ae5ac3f964e61634b1" integrity sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ== @@ -13827,7 +13832,7 @@ vue-template-es2015-compiler@^1.9.0: resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825" integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw== -vue@2.7.14: +vue@^2.7.14: version "2.7.14" resolved "https://registry.yarnpkg.com/vue/-/vue-2.7.14.tgz#3743dcd248fd3a34d421ae456b864a0246bafb17" integrity sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==