mirror of
https://github.com/neosubhamoy/pytubepp-helper.git
synced 2026-02-04 11:22:22 +05:30
(feat): added extension manager
This commit is contained in:
36
makeFilesExecutable.js
Normal file
36
makeFilesExecutable.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const binSrc = path.join(__dirname, 'src-tauri', 'binaries');
|
||||
|
||||
function makeFilesExecutable() {
|
||||
try {
|
||||
if (!fs.existsSync(binSrc)) {
|
||||
console.error(`Binaries directory does not exist: ${binSrc}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(binSrc);
|
||||
const nonExeFiles = files.filter(file => !file.endsWith('.exe'));
|
||||
let count = 0;
|
||||
|
||||
for (const file of nonExeFiles) {
|
||||
const filePath = path.join(binSrc, file);
|
||||
if (fs.statSync(filePath).isFile()) {
|
||||
execSync(`chmod +x "${filePath}"`);
|
||||
console.log(`Made executable: ${file}`);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Successfully made ${count} files executable in ${binSrc}`);
|
||||
} catch (error) {
|
||||
console.error(`Error making files executable: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
makeFilesExecutable();
|
||||
Reference in New Issue
Block a user