New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile symlinked files into plugin #25

Closed
JackNoordhuis opened this Issue Feb 14, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@JackNoordhuis

JackNoordhuis commented Feb 14, 2018

I have my plugin.yml, src folder and resources folder symlinked into the source plugin folder on my test server and upon running /makeplugin {plugin_name} I receive this error:

[06:28:53] [Server thread/CRITICAL]: Unhandled exception executing command 'makeplugin Components' in makeplugin: Iterator RegexIterator returned a path "/Users/Jack/Documents/CrazedCraft/Components/plugin.yml" that is not in the base directory "/Users/Jack/Stuff/PocketMine/CC – Duels/plugins/ALPHA_Components/"
[06:28:53] [Server thread/CRITICAL]: UnexpectedValueException: "Iterator RegexIterator returned a path "/Users/Jack/Documents/CrazedCraft/Components/plugin.yml" that is not in the base directory "/Users/Jack/Stuff/PocketMine/CC – Duels/plugins/ALPHA_Components/"" (EXCEPTION) in "/plugins/DevTools.phar/src/DevTools/DevTools" at line 249

I managed to get around this by replacing this code:

		//If paths contain any of these, they will be excluded
		$excludedSubstrings = [
			"/.", //"Hidden" files, git information etc
			realpath($pharPath) //don't add the phar to itself
		];
		$regex = sprintf('/^(?!.*(%s))^%s(%s).*/i',
			implode('|', $this->preg_quote_array($excludedSubstrings, '/')), //String may not contain any of these substrings
			preg_quote($basePath, '/'), //String must start with this path...
			implode('|', $this->preg_quote_array($includedPaths, '/')) //... and must be followed by one of these relative paths, if any were specified. If none, this will produce a null capturing group which will allow anything.
		);
		$count = count($phar->buildFromDirectory($basePath, $regex));
		$sender->sendMessage("[DevTools] Added $count files");

With this older code from the original repo:

		foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($basePath . "src")) as $file){
			$path = ltrim(str_replace(["\\", $basePath], ["/", ""], $file), "/");
			if($path{0} === "." or strpos($path, "/.") !== false or substr($path, 0, 4) !== "src/"){
				continue;
			}
			$phar->addFile($file, $path);
			$sender->sendMessage("[DevTools] Adding $path");
		}

* Disclaimer: I'm running a slightly modified version of devtools so it loads on older versions of PocketMine but I haven't altered anything that would cause this to occur. *

@dktapps

This comment has been minimized.

Member

dktapps commented Feb 14, 2018

Not sure what can really be done about that. The old code is horribly slow, that's why it was replaced.

dktapps added a commit that referenced this issue Feb 14, 2018

dktapps added a commit that referenced this issue Feb 14, 2018

dktapps added a commit that referenced this issue Feb 14, 2018

@dktapps dktapps referenced this issue Feb 14, 2018

Merged

Symlink fix #26

@dktapps dktapps closed this in #26 Mar 21, 2018

dktapps added a commit that referenced this issue Mar 21, 2018

Symlink fix (#26)
* Fixed building with symlinked files with ConsoleScript
this fixes #25 for ConsoleScript.

* Copy fix for #25 to DevTools itself for plugin fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment