forked from joomla/Component-Builder
Trying to resolve the link issue in windows gh-231
This commit is contained in:
parent
f31c8968e7
commit
da16b61ffb
@ -146,11 +146,11 @@ TODO
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 9th March, 2019
|
+ *Last Build*: 13th March, 2019
|
||||||
+ *Version*: 2.9.13
|
+ *Version*: 2.9.13
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **203581**
|
+ *Line count*: **203649**
|
||||||
+ *Field count*: **1114**
|
+ *Field count*: **1114**
|
||||||
+ *File count*: **1337**
|
+ *File count*: **1337**
|
||||||
+ *Folder count*: **209**
|
+ *Folder count*: **209**
|
||||||
|
@ -146,11 +146,11 @@ TODO
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 9th March, 2019
|
+ *Last Build*: 13th March, 2019
|
||||||
+ *Version*: 2.9.13
|
+ *Version*: 2.9.13
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **203581**
|
+ *Line count*: **203649**
|
||||||
+ *Field count*: **1114**
|
+ *Field count*: **1114**
|
||||||
+ *File count*: **1337**
|
+ *File count*: **1337**
|
||||||
+ *Folder count*: **209**
|
+ *Folder count*: **209**
|
||||||
|
@ -5807,7 +5807,7 @@ class Get
|
|||||||
$commentType = 0;
|
$commentType = 0;
|
||||||
// make sure we have the path correct (the script file is not in admin path for example)
|
// make sure we have the path correct (the script file is not in admin path for example)
|
||||||
// there may be more... will nead to keep our eye on this... since files could be moved during install
|
// there may be more... will nead to keep our eye on this... since files could be moved during install
|
||||||
$file = str_replace('./', '', $file);
|
$file = str_replace( './', '', $file); # TODO (windows path issues)
|
||||||
if ($file !== 'script.php')
|
if ($file !== 'script.php')
|
||||||
{
|
{
|
||||||
$path = $target . '/' . $file;
|
$path = $target . '/' . $file;
|
||||||
@ -5981,6 +5981,8 @@ class Get
|
|||||||
$hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true);
|
$hasharray = array_slice($fingerPrint, -$inFinger, $getFinger, true);
|
||||||
$hasleng = count($hasharray);
|
$hasleng = count($hasharray);
|
||||||
$hashtarget = $hasleng . '__' . md5(implode('', $hasharray));
|
$hashtarget = $hasleng . '__' . md5(implode('', $hasharray));
|
||||||
|
// for good practice
|
||||||
|
ComponentbuilderHelper::fixPath($path);
|
||||||
// all new records we can do a buldk insert
|
// all new records we can do a buldk insert
|
||||||
if ($i === 1 || !$id)
|
if ($i === 1 || !$id)
|
||||||
{
|
{
|
||||||
|
@ -830,7 +830,8 @@ class Structure extends Get
|
|||||||
// set the template folder path
|
// set the template folder path
|
||||||
$templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/';
|
$templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/';
|
||||||
// set the final paths
|
// set the final paths
|
||||||
$currentFullPath = str_replace('//', '/', $templatePath . '/' . $item);
|
$currentFullPath = (preg_match('/^[a-z]:/i', $item)) ? $item : $templatePath . '/' . $item;
|
||||||
|
$currentFullPath = str_replace('//', '/', $currentFullPath);
|
||||||
$packageFullPath = str_replace('//', '/', $path . '/' . $new);
|
$packageFullPath = str_replace('//', '/', $path . '/' . $new);
|
||||||
$zipFullPath = str_replace('//', '/', $zipPath . '/' . $new);
|
$zipFullPath = str_replace('//', '/', $zipPath . '/' . $new);
|
||||||
// now move the file
|
// now move the file
|
||||||
@ -1287,17 +1288,22 @@ class Structure extends Get
|
|||||||
$pointer_tracker = 'h';
|
$pointer_tracker = 'h';
|
||||||
foreach ($this->componentData->folders as $custom)
|
foreach ($this->componentData->folders as $custom)
|
||||||
{
|
{
|
||||||
// by default custom path is true
|
// for good practice
|
||||||
$customPath = 'custom';
|
ComponentbuilderHelper::fixPath($custom, array('path', 'folder', 'folderpath'));
|
||||||
// fix custom path
|
// fix custom path
|
||||||
if (isset($custom['path']) && ComponentbuilderHelper::checkString($custom['path']))
|
if (isset($custom['path']) && ComponentbuilderHelper::checkString($custom['path']))
|
||||||
{
|
{
|
||||||
$custom['path'] = trim($custom['path'], '/');
|
$custom['path'] = trim($custom['path'], '/');
|
||||||
}
|
}
|
||||||
|
// by default custom path is true
|
||||||
|
$customPath = 'custom';
|
||||||
// set full path if this is a full path folder
|
// set full path if this is a full path folder
|
||||||
if (!isset($custom['folder']) && isset($custom['folderpath']))
|
if (!isset($custom['folder']) && isset($custom['folderpath']))
|
||||||
{
|
{
|
||||||
$custom['folder'] = '/' . trim($custom['folderpath'], '/');
|
// set the folder path with / if does not have a drive/windows full path
|
||||||
|
$custom['folder'] = (preg_match('/^[a-z]:/i', $custom['folderpath']))
|
||||||
|
? trim($custom['folderpath'], '/')
|
||||||
|
: '/' . trim($custom['folderpath'], '/');
|
||||||
// update the dynamic path
|
// update the dynamic path
|
||||||
$custom['folder'] = $this->updateDynamicPath($custom['folder']);
|
$custom['folder'] = $this->updateDynamicPath($custom['folder']);
|
||||||
// remove the file path
|
// remove the file path
|
||||||
@ -1369,11 +1375,17 @@ class Structure extends Get
|
|||||||
$pointer_tracker = 'h';
|
$pointer_tracker = 'h';
|
||||||
foreach ($this->componentData->files as $custom)
|
foreach ($this->componentData->files as $custom)
|
||||||
{
|
{
|
||||||
|
// for good practice
|
||||||
|
ComponentbuilderHelper::fixPath($custom, array('path', 'file', 'filepath'));
|
||||||
|
// by default custom path is true
|
||||||
$customPath = 'custom';
|
$customPath = 'custom';
|
||||||
// set full path if this is a full path file
|
// set full path if this is a full path file
|
||||||
if (!isset($custom['file']) && isset($custom['filepath']))
|
if (!isset($custom['file']) && isset($custom['filepath']))
|
||||||
{
|
{
|
||||||
$custom['file'] = '/' . trim($custom['filepath'], '/');
|
// set the file path with / if does not have a drive/windows full path
|
||||||
|
$custom['file'] = (preg_match('/^[a-z]:/i', $custom['filepath']))
|
||||||
|
? trim($custom['filepath'], '/')
|
||||||
|
: '/' . trim($custom['filepath'], '/');
|
||||||
// update the dynamic path
|
// update the dynamic path
|
||||||
$custom['file'] = $this->updateDynamicPath($custom['file']);
|
$custom['file'] = $this->updateDynamicPath($custom['file']);
|
||||||
// remove the file path
|
// remove the file path
|
||||||
|
@ -408,6 +408,40 @@ abstract class ComponentbuilderHelper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix the path to work in the JCB script <-- (main issue here)
|
||||||
|
* Since we need / slash in all paths, for the JCB script even if it is Windows
|
||||||
|
* and since MS works with both forward and back slashes
|
||||||
|
* we just convert all slashes to forward slashes
|
||||||
|
*
|
||||||
|
* THIS is just my hack (fix) if you know a better way! speak-up!
|
||||||
|
*
|
||||||
|
* @param mix $values the array of paths or the path as a string
|
||||||
|
* @param array $targets paths to target
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function fixPath(&$values, $targets = array())
|
||||||
|
{
|
||||||
|
// if multiple to gets searched and fixed
|
||||||
|
if (self::checkArray($values) && self::checkArray($targets))
|
||||||
|
{
|
||||||
|
foreach ($targets as $target)
|
||||||
|
{
|
||||||
|
if (isset($values[$target]) && strpos($values[$target], '\\') !== false)
|
||||||
|
{
|
||||||
|
$values[$target] = str_replace('\\', '/', $values[$target]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if just a string
|
||||||
|
elseif (self::checkString($values) && strpos($values, '\\') !== false)
|
||||||
|
{
|
||||||
|
$values = str_replace('\\', '/', $values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all the file paths in folder and sub folders
|
* get all the file paths in folder and sub folders
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="3.2" method="upgrade">
|
<extension type="component" version="3.2" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>9th March, 2019</creationDate>
|
<creationDate>13th March, 2019</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||||
|
@ -408,6 +408,40 @@ abstract class ComponentbuilderHelper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix the path to work in the JCB script <-- (main issue here)
|
||||||
|
* Since we need / slash in all paths, for the JCB script even if it is Windows
|
||||||
|
* and since MS works with both forward and back slashes
|
||||||
|
* we just convert all slashes to forward slashes
|
||||||
|
*
|
||||||
|
* THIS is just my hack (fix) if you know a better way! speak-up!
|
||||||
|
*
|
||||||
|
* @param mix $values the array of paths or the path as a string
|
||||||
|
* @param array $targets paths to target
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function fixPath(&$values, $targets = array())
|
||||||
|
{
|
||||||
|
// if multiple to gets searched and fixed
|
||||||
|
if (self::checkArray($values) && self::checkArray($targets))
|
||||||
|
{
|
||||||
|
foreach ($targets as $target)
|
||||||
|
{
|
||||||
|
if (isset($values[$target]) && strpos($values[$target], '\\') !== false)
|
||||||
|
{
|
||||||
|
$values[$target] = str_replace('\\', '/', $values[$target]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if just a string
|
||||||
|
elseif (self::checkString($values) && strpos($values, '\\') !== false)
|
||||||
|
{
|
||||||
|
$values = str_replace('\\', '/', $values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all the file paths in folder and sub folders
|
* get all the file paths in folder and sub folders
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user