mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-28 11:17:44 +00:00
aa984c4909
- Update `.gitignore` to include `lab/` for backtesting and raw data. - Refactor `app.py` to improve error handling and logging. - Remove deprecated files: `core/bot_logic.py`, `core/bots/base_bot.py`, `core/bots/manager.py`, `core/db/database.py`, `core/routes/api_analysis.py`, `core/routes/api_bots_analysis.py`, `core/strategies/logic_ma.py`, `core/strategies/logic_rsi.py`. - Modify multiple files to enhance bot management, routing, and strategy handling. - Update JavaScript and HTML templates for better UI and functionality.
31 lines
777 B
JavaScript
31 lines
777 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function del(targetPath) {
|
|
if (!fs.existsSync(targetPath)) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
if (fs.statSync(targetPath).isDirectory()) {
|
|
// If it's a directory, delete its contents first
|
|
fs.readdirSync(targetPath).forEach(file => {
|
|
const curPath = path.join(targetPath, file);
|
|
|
|
if (fs.statSync(curPath).isFile()) {
|
|
fs.unlinkSync(curPath); // Delete file
|
|
}
|
|
});
|
|
fs.rmdirSync(targetPath); // Delete the now-empty directory
|
|
} else {
|
|
fs.unlinkSync(targetPath); // If it's a file, delete it directly
|
|
}
|
|
|
|
return true;
|
|
} catch (error) {
|
|
console.error(`Error while deleting ${targetPath}: ${error.message}`);
|
|
}
|
|
}
|
|
|
|
module.exports = { del };
|