(fileData wshrpc.FileData)
| 29 | } |
| 30 | |
| 31 | func ensureFile(fileData wshrpc.FileData) (*wshrpc.FileInfo, error) { |
| 32 | info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout}) |
| 33 | err = convertNotFoundErr(err) |
| 34 | if err == fs.ErrNotExist { |
| 35 | err = wshclient.FileCreateCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout}) |
| 36 | if err != nil { |
| 37 | return nil, fmt.Errorf("creating file: %w", err) |
| 38 | } |
| 39 | info, err = wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout}) |
| 40 | if err != nil { |
| 41 | return nil, fmt.Errorf("getting file info: %w", err) |
| 42 | } |
| 43 | return info, err |
| 44 | } |
| 45 | if err != nil { |
| 46 | return nil, fmt.Errorf("getting file info: %w", err) |
| 47 | } |
| 48 | return info, nil |
| 49 | } |
| 50 | |
| 51 | func streamWriteToFile(fileData wshrpc.FileData, reader io.Reader) error { |
| 52 | // First truncate the file with an empty write |
no test coverage detected