--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
Since posting the original workaround I've managed to refine it a little and can now present workaround 2.0!
The Microsoft junction utility works well enough but its license requirements prevent it from being a useful, re-distributable solution (and the GUI license dialog is less than impressive!) Fortunately I've found an alternative that is re-distributable in a 'ln' replacement from http://www.flexhex.com/docs/articles/hard-links.phtml. This works much like the UNIX equivalent and is a much better option as it can be re-distributed.
The original workaround actually contains two fixes: one for the junction problem and another for a 7za issue. I've been unable to get 7za to work for any downloaded package and have used the GNU tar and gzip files to provide an alternative. I've seen mention of the7za issue ('cannot use absolute path with this command') elsewhere in this mailing list but no solution appears to be available. Maybe it's an XP issue. Either way I've adopted the MSYS tools instead as they appear to work well enough.
To make life easy for everyone I've combined the files into a download package located at:
http://sourceforge.net/projects/swatwork/files/dart/
To install, unzip to a location of your choice and put the 'bin' directory in the PATH.
(I'm hosting this file myself for the moment but I'm quite happy for it to be moved elsewhere or incorporated into the Dart project in whatever form works best.)
Next the code changes required to Pub.
All the changes are in $DART_SDK/util/pub/io.dart.
CreateSymLink() (line 297) now looks like this:
Future<File> createSymlink(from, to) {
from = _getPath(from);
to = _getPath(to);
var command = 'ln';
var args = ['-s', from, to];
if (Platform.operatingSystem == 'windows') {
// Crude test for WindowsXP
if (Platform.environment['PROGRAMDATA'] == null) {
args = [from, to];
}
else {
// Call mklink on Windows to create an NTFS junction point. Only works on
// Vista or later. (Junction points are available earlier, but the "mklink"
// command is not.) I'm using a junction point (/j) here instead of a soft
// link (/d) because the latter requires some privilege shenanigans that
// I'm not sure how to specify from the command line.
command = 'mklink';
args = ['/j', to, from];
}
}
return runProcess(command, args).transform((result) {
// TODO(rnystrom): Check exit code and output?
return new File(to);
});
}
and extractTarGz() (line 625) now looks like this:
Future<bool> extractTarGz(InputStream stream, destination) {
destination = _getPath(destination);
if (Platform.operatingSystem == "windows" &&
Platform.environment['PROGRAMDATA'] != null) { // Ignore for Windows XP
return _extractTarGzWindows(stream, destination);
}
var completer = new Completer<int>();
var processFuture = Process.start("tar",
["--extract", "--gunzip", "--directory", destination]);
processFuture.then((process) {
process.onExit = completer.complete;
stream.pipe(process.stdin);
process.stdout.pipe(stdout, close: false);
process.stderr.pipe(stderr, close: false);
});
processFuture.handleException((error) {
completer.completeException(error);
return true;
});
return completer.future.transform((exitCode) => exitCode == 0);
}
These changes try to leave the existing Windows solution intact and use a crude test to detect Windows XP. There may be a better way of doing this. Also I've not been able to test this on Vista or Window 7.
At present, Dart Editor simply refuses to run Pub on Windows XP so no testing has been possible. I've identified the code that needs to change and have raised an issue (6724) for this.
In addition I've added this post to a new issue (6737) as requested.
Future<File> createSymlink(from, to) {
from = _getPath(from);
to = _getPath(to);
var command = 'ln';
var args = ['-s', from, to];
if (Platform.operatingSystem == 'windows') {
// Crude test for WindowsXP
if (Platform.environment['PROGRAMDATA'] == null) {
var scriptPath = new File(new Options().script).fullPathSync();
var scriptDir = new Path.fromNative(scriptPath).directoryPath;
command = scriptDir.append('7zip/ln.exe').canonicalize().toNativePath();
args = [from, to];
}
else {
// Call mklink on Windows to create an NTFS junction point. Only works on
// Vista or later. (Junction points are available earlier, but the "mklink"
// command is not.) I'm using a junction point (/j) here instead of a soft
// link (/d) because the latter requires some privilege shenanigans that
// I'm not sure how to specify from the command line.
command = 'mklink';
args = ['/j', to, from];
}
}
return runProcess(command, args).transform((result) {
// TODO(rnystrom): Check exit code and output?
return new File(to);
});
}
// Untar the archive into the destination directory.
return runProcess(command, ['x', tarFile], workingDir: destination);
Sorry guys,none of the solutions mentioned here works on Windows Server 2003. Some of the workarounds even create damaged symbolic links which can only be deleted with rj.exe.Can't you just copy the files and folders on pre-Vista machines?
The symbolic link stuff is dark magic on Windows anyway.I think, as long as this problem exists, it will scare away lots of windows developers. I certainly suspended everything for now, because the broken pub really makes the whole Dart Editor feel broken.CheersBernd
--
if (Platform.operatingSystem == 'windows') {
// Call mklink on Windows to create an NTFS junction point. Only works on
// Vista or later. (Junction points are available earlier, but the "mklink"
// command is not.) I'm using a junction point (/j) here instead of a soft
// link (/d) because the latter requires some privilege shenanigans that
// I'm not sure how to specify from the command line.
command = 'linkd';
args = [to, from];
}--
command = 'linkd';
args = [symlink, target];
Nice. To bad that everybody in my company has to develop on win2003 server. Good that there is always a workaround.
Try Webstorm.
But there might be issues in pub as well which is independent from the iDE.
What's the current status on this? Is it possible to develop for Dart on WinXP? Do the workarounds still work? Other possibilities? I'm especially interested in coding in Dart, then compiling to JS. Are there maybe other toolchains one could use?
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
What's the current status on this? Is it possible to develop for Dart on WinXP? Do the workarounds still work? Other possibilities? I'm especially interested in coding in Dart, then compiling to JS. Are there maybe other toolchains one could use?
Is that possible to wrapping the mklink things as dart api? So we directly using dart code to create junctions/symbol links
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
Is that possible to wrapping the mklink things as dart api? So we directly using dart code to create junctions/symbol links
I found xp support for junction API by default, no driver need to be installed, it's happens to be a stub for xp to create symbolic staff in xp.
> Cheers,
...
Since then, the team has decided to not support Windows XP. If you can get it working on your own, that's great, but we can't really offer any help. Since we have no testing infrastructure for XP, it would be impossible for us to guarantee any level of support since we can't even validate it ourselves.Sorry. :(- bob
Its dart or dart editor?
> Dennis
Would the team consider changing the mandatory halt under XP to a warning like, "Unsupported operating system, proceed at your own risk" option?