Skip to content

Commit

Permalink
Add support for new files in a new folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kynatro committed Apr 12, 2023
1 parent fc34ac3 commit 3f119b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/gitBackup.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ async function getStatuses() {
if (match) {
const status = STATUSES[match[1]];
const filePath = match[2];
const filePathStatus = fs.statSync(path.resolve(APP_ROOT_FOLDER, filePath));
const absPath = path.resolve(APP_ROOT_FOLDER, filePath);
const filePathStatus = fs.existsSync(absPath) ? fs.statSync(absPath) : false;
const isDirectory = filePathStatus ? filePathStatus.isDirectory() : false;

// Folders in the status output indicate completely un-tracked folders
if (filePathStatus.isDirectory()) {
fs.readdirSync(filePath).forEach((node) => {
if (isDirectory) {
fs.readdirSync(absPath).forEach((node) => {
statuses.push({
status: STATUS_NEW,
filePath: path.join(filePath, node)
Expand Down

0 comments on commit 3f119b7

Please sign in to comment.