Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1251)

Unified Diff: which/lib/src/is_executable.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « which/lib/src/has_permission.dart ('k') | which/lib/src/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: which/lib/src/is_executable.dart
diff --git a/which/lib/src/is_executable.dart b/which/lib/src/is_executable.dart
deleted file mode 100755
index 02fb83421ce1c0fa17cb05ea78d411eec56c5101..0000000000000000000000000000000000000000
--- a/which/lib/src/is_executable.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-
-library which.src.is_executable;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:when/when.dart';
-
-import 'has_permission.dart';
-
-Future<bool> isExecutable(String path, bool isWindows, Future<FileStat> getStat(path)) =>
- _isExecutable(path, isWindows, getStat);
-
-bool isExecutableSync(String path, bool isWindows, FileStat getStat(path)) =>
- _isExecutable(path, isWindows, getStat);
-
-_isExecutable(String path, bool isWindows, getStat(path)) =>
- when(() => getStat(path), onSuccess: (stat) => isExecutableStat(stat, isWindows));
-
-/// Tests whether the file exists and is executable.
-bool isExecutableStat(FileStat stat, bool isWindows) {
- if (FileSystemEntityType.FILE != stat.type) return false;
-
- // There is no concept of executable on windows.
- if (isWindows) return true;
-
- // TODO: This currently produces false positives (returns true when it
- // shouldn't) when the uid/gid of current user and executable don't
- // match. Fix if/when uid/gid support is added:
- // http://dartbug.com/22037.
- return FilePermissionRole.values.any((role) =>
- hasPermission(stat.mode, FilePermission.EXECUTE, role: role));
-}
« no previous file with comments | « which/lib/src/has_permission.dart ('k') | which/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698