summaryrefslogtreecommitdiff
path: root/src/files.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/files.php')
-rw-r--r--src/files.php38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/files.php b/src/files.php
index e78cfba..0bda901 100644
--- a/src/files.php
+++ b/src/files.php
@@ -5,8 +5,11 @@
5 5
6function makeFile($path, $file_name, $data) 6function makeFile($path, $file_name, $data)
7{ 7{
8 file_put_contents($path. $file_name, $data); 8 //~ if(is_writable('../' . $path))
9 chmod($path . $file_name, 0644); // droits en octal 9 //~ {
10 file_put_contents($path. $file_name, $data);
11 chmod($path . $file_name, 0644); // droits en octal
12 //~ }
10 13
11 //~ protected function createFile(string $latex, string $file_name, string $latexPath) 14 //~ protected function createFile(string $latex, string $file_name, string $latexPath)
12 //~ { 15 //~ {
@@ -24,11 +27,31 @@ function makeFile($path, $file_name, $data)
24 27
25function makeFolder(string $path) 28function makeFolder(string $path)
26{ 29{
30 $rights = 0755; // droits en octal
31
27 if(!file_exists($path)) 32 if(!file_exists($path))
28 { 33 {
29 mkdir($path); 34 //~ if(is_writable('../' . $path))
30 chmod($path, 0755); // droits en octal 35 //~ {
36 mkdir($path);
37 chmod($path, $rights);
38 //~ }
39 //~ else
40 //~ {
41 //~ echo "debug: la création du dossier " . $path . " est impossible\n";
42 //~ }
31 } 43 }
44 else
45 {
46 //~ if(is_writable($path))
47 //~ {
48 chmod($path, $rights);
49 //~ }
50 //~ else
51 //~ {
52 //~ echo "debug: la modification des droits du dossier " . $path . " est impossible\n";
53 //~ }
54 }
32} 55}
33 56
34// commande système pdflatex 57// commande système pdflatex
@@ -38,12 +61,13 @@ function latexToPdf(string $latex_path, string $file_name, string $pdf_path)
38 $output_dir = ''; 61 $output_dir = '';
39 if($pdf_path !== '') 62 if($pdf_path !== '')
40 { 63 {
41 $output_dir = '-output-directory=' . $pdf_path . ' '; 64 $output_dir = '-output-directory=' . $pdf_path;
42 } 65 }
43 66
44 // compilation 67 // compilation
45 //echo 'pdflatex ' . $output_dir . $latex_path . $file_name . "\n"; 68 //echo 'pdflatex ' . $output_dir . ' ' . $latex_path . $file_name . "\n";
46 exec('pdflatex ' . $output_dir . $latex_path . $file_name); 69 //die;
70 exec('pdflatex ' . $output_dir . ' ' . $latex_path . $file_name);
47 71
48 // nettoyage 72 // nettoyage
49 $basename = basename($file_name, '.tex'); 73 $basename = basename($file_name, '.tex');