Skip to content

Support Windows dev enviornment #335

Open
@maple135790

Description

@maple135790

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);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions