获取系统的路径分隔符

2086次阅读  |  发布于5年以前

获取系统的路径分隔符

Use Platform.pathSeparator to get the separator used by the operating system to separate components in file. Or, use the separator getter in the path Pub package.

import 'dart:io' show Platform;
import 'package:path/path.dart' as path;

main() {
  // Prints  '\' on Windows and '/' on other platforms.
  print(Platform.pathSeparator);

  // This does the same.
  print(path.separator);
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8