Lines 43-52
Link Here
|
43 |
*/ |
43 |
*/ |
44 |
package org.netbeans.modules.cnd.makeproject.api.wizards; |
44 |
package org.netbeans.modules.cnd.makeproject.api.wizards; |
45 |
|
45 |
|
|
|
46 |
import com.sun.javafx.util.Utils; |
46 |
import java.io.BufferedReader; |
47 |
import java.io.BufferedReader; |
47 |
import java.io.BufferedWriter; |
48 |
import java.io.BufferedWriter; |
48 |
import java.io.ByteArrayOutputStream; |
49 |
import java.io.ByteArrayOutputStream; |
49 |
import java.io.File; |
50 |
import java.io.File; |
|
|
51 |
import java.io.FileInputStream; |
52 |
import java.io.FileOutputStream; |
50 |
import java.io.IOException; |
53 |
import java.io.IOException; |
51 |
import java.io.InputStream; |
54 |
import java.io.InputStream; |
52 |
import java.io.InputStreamReader; |
55 |
import java.io.InputStreamReader; |
Lines 85-92
Link Here
|
85 |
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory; |
88 |
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory; |
86 |
import org.netbeans.modules.nativeexecution.api.util.ProcessUtils; |
89 |
import org.netbeans.modules.nativeexecution.api.util.ProcessUtils; |
87 |
import org.netbeans.modules.remote.spi.FileSystemProvider; |
90 |
import org.netbeans.modules.remote.spi.FileSystemProvider; |
|
|
91 |
import org.netbeans.modules.remote.spi.WarmapHintProvider; |
88 |
import org.openide.filesystems.FileLock; |
92 |
import org.openide.filesystems.FileLock; |
89 |
import org.openide.filesystems.FileObject; |
93 |
import org.openide.filesystems.FileObject; |
|
|
94 |
import org.openide.filesystems.FileSystem; |
90 |
import org.openide.filesystems.FileUtil; |
95 |
import org.openide.filesystems.FileUtil; |
91 |
import org.openide.filesystems.URLMapper; |
96 |
import org.openide.filesystems.URLMapper; |
92 |
import org.openide.util.Lookup; |
97 |
import org.openide.util.Lookup; |
Lines 520-527
Link Here
|
520 |
} |
525 |
} |
521 |
} |
526 |
} |
522 |
|
527 |
|
523 |
private static void unzip(InputStream source, FileObject targetFolder) throws IOException { |
528 |
private static void unzip(InputStream source, FileObject targetFolder) throws IOException { |
524 |
//installation |
529 |
//installation |
|
|
530 |
final ExecutionEnvironment env = FileSystemProvider.getExecutionEnvironment(targetFolder); |
531 |
if (env.isRemote()) { |
532 |
final FileSystem fs = targetFolder.getFileSystem(); |
533 |
final FileObject zipFO = fs.createTempFile(targetFolder, "__tmp", ".zip", false); //NOI18N |
534 |
final OutputStream os = zipFO.getOutputStream(); |
535 |
File tmpZipFile = null; |
536 |
try { |
537 |
tmpZipFile = File.createTempFile("sample", ".zip"); |
538 |
try (FileOutputStream fos = new FileOutputStream(tmpZipFile)) { |
539 |
FileUtil.copy(source, fos); |
540 |
} |
541 |
source = new FileInputStream(tmpZipFile); |
542 |
FileUtil.copy(source, os); |
543 |
os.close(); |
544 |
// StringBuilder script = new StringBuilder(); |
545 |
// script.append("\'").append("unzip -q ").append(zipFO.getNameExt()).append(" && rm ").append(zipFO.getPath()); //NOI18N |
546 |
//// if (Utils.isWindows() || Boolean.getBoolean("remote.test.dos2unix")) { //NOI18N |
547 |
//// script.append(" && (which dos2unix > /dev/null; if [ $? = 0 ]; then find . -name \"*[Mm]akefile*\" -exec dos2unix {} \\; ; else echo \"no_dos2unix\"; fi)"); //NOI18N |
548 |
//// } |
549 |
// script.append("\'"); //NOI18N |
550 |
// ProcessUtils.ExitStatus rc = ProcessUtils.executeInDir(targetFolder.getPath(), env, "sh", "-x", "-c", script.toString()); //NOI18N |
551 |
ProcessUtils.ExitStatus rc = ProcessUtils.executeInDir(targetFolder.getPath(), env, "unzip", "-q", zipFO.getNameExt()); //NOI18N |
552 |
if (!rc.isOK()) { |
553 |
throw new IOException(rc.getErrorString()); |
554 |
} |
555 |
WarmapHintProvider.setWarmupZip(targetFolder, tmpZipFile); |
556 |
List<String> out = rc.getOutputLines(); |
557 |
if (out != null && !out.isEmpty() && out.get(0).startsWith("no_dos2unix")) { //NOI18N |
558 |
// There is no dos2unix on the machine: |
559 |
// need to update makefiles one by one |
560 |
} |
561 |
} finally { |
562 |
// if (tmpZipFile != null) { |
563 |
// tmpZipFile.delete(); |
564 |
// } |
565 |
targetFolder.refresh(); |
566 |
} |
567 |
return; |
568 |
} |
525 |
ZipInputStream zip = new ZipInputStream(source); |
569 |
ZipInputStream zip = new ZipInputStream(source); |
526 |
try { |
570 |
try { |
527 |
ZipEntry ent; |
571 |
ZipEntry ent; |