Skip to content

Commit d09ecbe

Browse files
committed
remove dependency on URL
1 parent 8a816c5 commit d09ecbe

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Plugins/AWSLambdaDeployer/Plugin.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ struct AWSLambdaPackager: CommandPlugin {
102102

103103
// create and execute a plugin helper to run the "swift" command
104104
let helperFilePath = "\(projectDirectory)/compile.sh"
105-
let helperFileUrl = URL(fileURLWithPath: helperFilePath)
106-
try helperCmd.write(to: helperFileUrl, atomically: true, encoding: .utf8)
107-
try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: helperFilePath)
105+
FileManager.default.createFile(atPath: helperFilePath,
106+
contents: helperCmd.data(using: .utf8),
107+
attributes: [.posixPermissions: 0o755])
108108
let samDeploymentDescriptor = try Utils.execute(
109109
executable: Path("/bin/bash"),
110110
arguments: ["-c", helperFilePath],
@@ -116,12 +116,11 @@ struct AWSLambdaPackager: CommandPlugin {
116116
// arguments: Array(cmd.dropFirst()),
117117
// customWorkingDirectory: context.package.directory,
118118
// logLevel: configuration.verboseLogging ? .debug : .silent)
119-
try FileManager.default.removeItem(at: helperFileUrl)
119+
try FileManager.default.removeItem(atPath: helperFilePath)
120120

121121
// write the generated SAM deployment decsriptor to disk
122-
let samDeploymentDescriptorFileUrl = URL(fileURLWithPath: samDeploymentDescriptorFilePath)
123-
try samDeploymentDescriptor.write(
124-
to: samDeploymentDescriptorFileUrl, atomically: true, encoding: .utf8)
122+
FileManager.default.createFile(atPath: samDeploymentDescriptorFilePath,
123+
contents: samDeploymentDescriptor.data(using: .utf8))
125124
verboseLogging ? print("\(samDeploymentDescriptorFilePath)") : nil
126125

127126
} catch let error as DeployerPluginError {

0 commit comments

Comments
 (0)