Skip to content

Commit

Permalink
license module updates
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Apr 3, 2024
1 parent 5e9bfea commit ea7ba86
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
40 changes: 34 additions & 6 deletions packages/nexrender-core/src/helpers/license.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ const fs = require('fs')
const os = require('os')
const path = require('path')

module.exports = (settings) => {
const filename = 'ae_render_only_node.txt'
const documents = path.join(os.homedir(), 'Documents')
const adobe = path.join(documents, 'Adobe')
const nodefile1 = path.join(documents, filename)
const nodefile2 = path.join(adobe, filename)
const filename = 'ae_render_only_node.txt'
const documents = path.join(os.homedir(), 'Documents')
const adobe = path.join(documents, 'Adobe')
const nodefile1 = path.join(documents, filename)
const nodefile2 = path.join(adobe, filename)

const add = (settings) => {
if (!settings.addLicense) {
return false
}

settings.logger.log('adding default render-only-node licenses for After Effects at:')
settings.logger.log(' - ' + nodefile1)
Expand All @@ -33,4 +37,28 @@ module.exports = (settings) => {
settings.track('Init Render License Added')
settings.logger.log('added render-only-node licenses for After Effects')
}

return applied
}

const remove = (settings) => {
let removed = false

if (fs.existsSync(nodefile1)) {
fs.unlinkSync(nodefile1)
removed = true
}

if (fs.existsSync(nodefile2)) {
fs.unlinkSync(nodefile2)
removed = true
}

if (removed) {
settings.logger.log('removed render-only-node licenses for After Effects')
}

return removed
}

module.exports = { add, remove }
4 changes: 1 addition & 3 deletions packages/nexrender-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ const init = (settings) => {
}

// add license helper
if (settings.addLicense) {
license(settings);
}
license.add(settings);

// attempt to patch the default
// Scripts/commandLineRenderer.jsx
Expand Down

0 comments on commit ea7ba86

Please sign in to comment.