Browse Source

Correction bug création de dossier

Loquicom 5 years ago
parent
commit
40405766b4
2 changed files with 6 additions and 2 deletions
  1. 2 2
      coauth.js
  2. 4 0
      src/file.js

+ 2 - 2
coauth.js

@@ -67,7 +67,7 @@ if (process.argv[2] !== 'prepare') {
         }).then(answer => {
             // Lancement du prgramme
             if (program.process) {
-                preprocessFile = './data/tmp.ppf';
+                preprocessFile = './tmp.ppf';
                 parse(source, preprocessFile, ppf => {
                     find(ppf, answer.name, () => {
                         file.fs.unlinkSync(preprocessFile);
@@ -81,7 +81,7 @@ if (process.argv[2] !== 'prepare') {
     // Sinon on lance le programme
     else {
         if (program.process) {
-            preprocessFile = './data/tmp.ppf';
+            preprocessFile = './tmp.ppf';
             parse(source, preprocessFile, ppf => {
                 find(ppf, name, () => {
                     file.fs.unlinkSync(preprocessFile);

+ 4 - 0
src/file.js

@@ -17,6 +17,10 @@ module.exports.exist = function (path, verbose = false) {
 module.exports.makedir = function (path, isFilePath = false, verbose = false) {
     if (isFilePath) {
         let split = path.split('/');
+        // SI ce n'est qu'un fichier
+        if (split.length === 1) {
+            return true;
+        }
         delete split[split.length - 1];
         path = split.join('/');
     }