forked from wix-incubator/wix-embedded-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from carmigo/bug/windows-version8-fix
fix windows error running version 8.x
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
wix-embedded-mysql/src/main/java/com/wix/mysql/distribution/setup/NixBefore8Initializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.wix.mysql.distribution.setup; | ||
|
||
import com.wix.mysql.config.MysqldConfig; | ||
import com.wix.mysql.distribution.Version; | ||
import de.flapdoodle.embed.process.config.IRuntimeConfig; | ||
import de.flapdoodle.embed.process.distribution.Platform; | ||
import de.flapdoodle.embed.process.extract.IExtractedFileSet; | ||
import org.apache.commons.io.filefilter.RegexFileFilter; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.File; | ||
import java.io.FileFilter; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
|
||
public class NixBefore8Initializer implements Initializer { | ||
|
||
private final static Logger logger = LoggerFactory.getLogger(NixBefore8Initializer.class); | ||
private static final String SEP = File.separator; | ||
|
||
@Override | ||
public boolean matches(Version version) { | ||
return Platform.detect().isUnixLike() && | ||
version.getMajorVersion().equals("8.0"); | ||
} | ||
|
||
@Override | ||
public void apply(IExtractedFileSet files, IRuntimeConfig runtimeConfig, MysqldConfig config) throws IOException { | ||
File baseDir = files.baseDir(); | ||
File libDir = new File(baseDir + SEP + "lib"); | ||
FileFilter filter = new RegexFileFilter("^[a-z]+\\.so(\\.[0-9]+)+"); | ||
File[] soFiles = libDir.listFiles(filter); | ||
for (File file : soFiles) { | ||
Files.createSymbolicLink(Paths.get(baseDir + SEP + "bin" + SEP + file.getName()), Paths.get(file.getPath())); | ||
logger.debug("Symlink " + file.getName()); | ||
} | ||
} | ||
} |