Commit Graph

3 Commits

Author SHA1 Message Date
Slava Egorov 907c4838fd [dart_data_home] Add PID files helpers
createPidFile(dir, content) can be used to create the pid file for 
the current process with the given content in the dir.

listPidFiles(dir) can be used to list pid files in the given directory.

Both functions will purge stale pid files from the given directory.
The implementation operates under the assumption that there is only
a small number of processes using pid files running at any given
time so there will ever be only a very small number of pid files
in the directory.

TEST=pid_files_test

Change-Id: Id83a7f6138511f755ab47347c17b44d66a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2026-03-12 07:11:47 -07:00
Daco Harkes 40a5bd0e08 [pkg] Fix dart_data_home typo
Change-Id: Iffdcbfe8cabcde8042544fa279d3ffbd91d936ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440620
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-07-16 02:21:02 -07:00
Daco Harkes 2af31661c6 [pkg] Introduce dart_data_home
The directory location depends on the current OS:
 - on Windows:
   - `%LOCALAPPDATA%\Dart\<tool>`
 - on Mac OS:
   - `$HOME/Library/Application Support/Dart/<tool>`
 - on Linux:
   - `$XDG_STATE_HOME/Dart/<tool>` if `$XDG_STATE_HOME` is defined,
      and
   - `$HOME/.local/state/Dart/<tool>` otherwise.

The Dart data home can be overridden with the `DART_DATA_HOME`
environment variable.

This CL does not start using the new location yet.

Bug: https://github.com/dart-lang/sdk/issues/60922
Bug: https://github.com/dart-lang/sdk/issues/41560
Bug: https://github.com/flutter/flutter/issues/59430
Change-Id: I55e0ba610f8665ea3c9f053b36c943b097313046
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440462
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-07-16 01:05:13 -07:00