Skip to content

Commit 2d88541

Browse files
Update FileSystemPersister to work with Windows.
Mainly, use std::path::Path so that the constructed paths are OS-agnostic. Also, Windows necessitates the use of OpenOptions with the `write` permission enabled to `sync_all` on a newly opened channel's data file.
1 parent c3729d7 commit 2d88541

File tree

1 file changed

+4
-1
lines changed
  • lightning-data-persister/src

1 file changed

+4
-1
lines changed

lightning-data-persister/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ impl<ChanSigner: ChannelKeys + Readable + Writeable> FilesystemPersister<ChanSig
6060
}
6161

6262
fn get_full_filepath(&self, funding_txo: OutPoint) -> String {
63-
format!("{}/{}_{}", self.path_to_channel_data, funding_txo.txid.to_hex(), funding_txo.index)
63+
let path = Path::new(&self.path_to_channel_data);
64+
let mut path_buf = path.to_path_buf();
65+
path_buf.push(format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index));
66+
path_buf.to_str().unwrap().to_string()
6467
}
6568

6669
// Utility to write a file to disk.

0 commit comments

Comments
 (0)