-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the
PLUGIN_FILE_CONTENT
environment variable to create a file
- Loading branch information
1 parent
a5079d3
commit 2ce2b13
Showing
3 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import Foundation | ||
|
||
try "File created with a plugin".write( | ||
let contentKey = "PLUGIN_FILE_CONTENT" | ||
guard let content = ProcessInfo.processInfo.environment[contentKey] else { | ||
fatalError("Environment variable not found: '\(contentKey)'.") | ||
} | ||
try content.write( | ||
to: URL(fileURLWithPath: "plugin-file.txt"), | ||
atomically: true, | ||
encoding: .utf8 | ||
) | ||
print("File created with a plugin!") | ||
print("File created with a plugin!") |