Skip to content
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

Support Windows dev enviornment #335

Open
maple135790 opened this issue Jan 3, 2025 · 1 comment
Open

Support Windows dev enviornment #335

maple135790 opened this issue Jan 3, 2025 · 1 comment

Comments

@maple135790
Copy link
Contributor

Create from #331

This repository can not be run under Windows environment due to the path separator is not handled. The fixes could involve some OS check to use certain path separator.

Path-included-comment

For the existing path-included-comment variable like _startComment and _endComment will not be changed. instead, creates a new variable _thisScriptOS for os-specific logic

final _thisScriptOS = 'bin${p.separator}update_bindings.dart';
const _thisScript = 'bin/update_bindings.dart';

const _startComment =
    '<!-- START updated by $_thisScript. Do not modify by hand -->';
const _endComment =
    '<!-- END updated by $_thisScript. Do not modify by hand -->';

Only the part that effect file logic will use _thisScriptOS

// before
  assert(p.fromUri(Platform.script).endsWith(_thisScript));
// after
  assert(p.fromUri(Platform.script).endsWith(_thisScriptOS));

File, Directory

In current impilementation,

  1. p.join() is hard-coded with POSIX path separators
  2. file path is using Uri().path, which is not ideal for Windows

fix 1:

// before
  final domDir = Directory(p.join(_webPackagePath, 'lib/src/dom'));
// after
  final domDir = Directory(p.join(_webPackagePath, 'lib', 'src', 'dom'));

fix 2:

// before
  final repoDir =
      Directory(Platform.script.resolve('../.dart_tool/mdn_content').path);
// after
  final repoUri = Platform.script.resolve('../.dart_tool/mdn_content');
  final repoPath = p.context.fromUri(repoUri);
  final repoDir = Directory(repoPath);
@srujzs
Copy link
Contributor

srujzs commented Jan 6, 2025

Thanks for filing! I haven't dug enough to know whether this is possible, but for the comments, it might make sense to keep the paths as Uris and use toFilePath() to always get the POSIX path in the comment. This would avoid the duplicate vars.

The rest seems to make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants