-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.js
45 lines (30 loc) · 1.13 KB
/
functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const fs = require('fs')
require('log-timestamp');
// make available globally
var locationPC = process.env.LOCALAPPDATA + "Low\\Kinemotik Studios\\Audio Trip\\Songs\\"
// check if PC version is installed
var pc = fs.existsSync(locationPC)
// check if Quest is connected
var quest = false
module.exports = {
entrypoint: function entrypoint(filePath, callback) {
var fileName = filePath.substr(filePath.lastIndexOf("\\") + 1)
// support only dropping an .ogg file
if (fileName.endsWith(".ogg") || fileName.endsWith(".ats")) {
console.log("File is valid. Deploying...")
this.deployToGame(filePath.substr(0, filePath.lastIndexOf("\\") + 1), fileName)
} else {
callback("The file type of '" + fileName + "' not valid.")
}
},
deployToGame: function deployToGame(path, file) {
// write audio file and generated song into custom song location
if (pc) {
fs.copyFileSync(path + file, locationPC + file)
}
var questWrapper = require('./questWrapper')
questWrapper.questIsConnected().then( data => {
questWrapper.copyToQuest(path, file)
})
}
}