raulfraile / distill

Smart compressed files extractor for PHP
MIT License
224 stars 21 forks source link

Make use of Windows command line tools to decompress files #6

Open raulfraile opened 10 years ago

raulfraile commented 10 years ago

Currently, Distill does not try to execute Windows command line tools to decompress files faster, as it does it Unix systems. For example, 7zip is available for Windows too, and it could be used.

The problem

In Unix systems, Distill checks if the command exists through the command utility, and if it exists (exit code is 0), the command can be executed. We need a way to make the same in Windows systems. Currently, if Distill is running on a Windows system, it just disables that method.

How to fix it

Decompression methods are located in the Distill\Method namespace. Methods based on command line tools are in Distill\Method\Command, which extends AbstractCommandMethod (it has the existsCommand method, the one that it should be modified). If a new method is added, it must be included to the format (e.g. methods for zip files) and in the container.

Available tools

This tools could be included once the support for Windows command line tools is added:

wouterj commented 9 years ago

A windows alternative is:

if ($this->isWindows()) {
    exec('where '.$command.' 2>&1', $output, $code);
}
// ...

Please note that some commands have bugs (e.g. tar doesn't support paths indicating the disk (C:\) in the source/target paths).

beni0888 commented 8 years ago

@raulfraile Is this feature already wanted and missing? If so, Is there any reason why this feature have not been implemented yet? Can I help with it?

raulfraile commented 8 years ago

@beni0888 yeah, it's missing and wanted :) The main reason why it wasn't implemented yet is because I don't have a windows machine to test it. Feel free to work on it, that would be awesome!

xabbuh commented 8 years ago

@raulfraile You could use Appveyor to have builds on Windows too (not useful for developing the feature but for noticing any breaks).

wouterj commented 8 years ago

I'll take a look at this today, if no-one else is working on this.

beni0888 commented 8 years ago

I haven't started working on it yet, so for me there is no problem