Fix orphan check at startup
parent
a02313ba77
commit
a45118c977
|
@ -57,12 +57,15 @@ module.exports = function(s,config){
|
|||
splitted[1] = user + ':' + pass + '@' + splitted[1]
|
||||
return splitted.join('://')
|
||||
}
|
||||
s.checkCorrectPathEnding = function(x){
|
||||
var length=x.length
|
||||
if(x.charAt(length-1)!=='/'){
|
||||
x=x+'/'
|
||||
s.checkCorrectPathEnding = function(x,reverse){
|
||||
var newString = `${x}`
|
||||
var length = x.length
|
||||
if(reverse && x.charAt(length-1) === '/'){
|
||||
newString = x.slice(0, -1)
|
||||
}else if(x.charAt(length-1) !== '/'){
|
||||
newString = x + '/'
|
||||
}
|
||||
return x.replace('__DIR__',s.mainDirectory)
|
||||
return newString.replace('__DIR__',s.mainDirectory)
|
||||
}
|
||||
s.mergeDeep = function(...objects) {
|
||||
const isObject = obj => obj && typeof obj === 'object';
|
||||
|
|
|
@ -62,7 +62,7 @@ module.exports = (s,config,lang) => {
|
|||
// const findCmd = [videosDirectory].concat(options.flags || ['-maxdepth','1'])
|
||||
fs.writeFileSync(
|
||||
tempDirectory + 'orphanCheck.sh',
|
||||
`find "${videosDirectory}" -maxdepth 1 -type f -exec stat -c "%n" {} + | sort -r | head -n ${options.checkMax}`
|
||||
`find "${s.checkCorrectPathEnding(videosDirectory,true)}" -maxdepth 1 -type f -exec stat -c "%n" {} + | sort -r | head -n ${options.checkMax}`
|
||||
);
|
||||
let listing = spawn('sh',[tempDirectory + 'orphanCheck.sh'])
|
||||
// const onData = options.onData ? options.onData : () => {}
|
||||
|
|
Loading…
Reference in New Issue