Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Fixed wrong path separator for code editor on windows https://github.com/givanz/Vvveb/issues/272

givanz65baa340f48f
diff --git a/admin/controller/editor/code.php b/admin/controller/editor/code.php
index 6052a1a..bab0e25 100755
--- a/admin/controller/editor/code.php
+++ b/admin/controller/editor/code.php
@@ -159,7 +159,7 @@ class Code extends Base {
$files[] = [
'name' => $f,
'type' => 'folder',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
'items' => $scan($dir . DS . $f), // Recursively get the contents of the folder
];
} else {
@@ -168,7 +168,7 @@ class Code extends Base {
$files[] = [
'name' => $f,
'type' => 'file',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
'size' => filesize($dir . DS . $f), // Gets the size of this file
];
}
diff --git a/admin/controller/product/digital-asset.php b/admin/controller/product/digital-asset.php
index 7c49d06..fb691a4 100644
--- a/admin/controller/product/digital-asset.php
+++ b/admin/controller/product/digital-asset.php
@@ -140,7 +140,7 @@ class DigitalAsset extends Crud {
$files[] = [
'name' => $f,
'type' => 'folder',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
'items' => $scan($dir . DS . $f), // Recursively get the contents of the folder
];
} else {
@@ -149,7 +149,7 @@ class DigitalAsset extends Crud {
$files[] = [
'name' => $f,
'type' => 'file',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
'size' => filesize($dir . DS . $f), // Gets the size of this file
];
}