diff options
| author | Nathan Jaremko | 2018-05-16 22:36:50 -0400 | 
|---|---|---|
| committer | Nathan Jaremko | 2018-05-16 22:36:50 -0400 | 
| commit | e394ea52b04a99ba55719a7a9764bca3ebb591d2 (patch) | |
| tree | c35a6d094d89eeec8adeb4e352d8d1c9cb010f7a | |
| parent | 0b9e9f9092b72b24ce1ec1fc058107f296c64838 (diff) | |
| download | podcast-e394ea52b04a99ba55719a7a9764bca3ebb591d2.tar.bz2 | |
Attempt to fix windows rename bug
| -rw-r--r-- | .travis.yml | 3 | ||||
| -rw-r--r-- | CHANGELOG | 3 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | src/actions.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/structs.rs | 16 | 
7 files changed, 23 insertions, 12 deletions
| diff --git a/.travis.yml b/.travis.yml index a13d602..a0eaddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,9 @@ matrix:      - os: linux        rust: beta        env: TARGET=x86_64-unknown-linux-gnu +    - os: osx +      rust: beta +      env: TARGET=x86_64-apple-darwin  before_install:    - export PATH="$PATH:$HOME/.cargo/bin" @@ -1,3 +1,6 @@ +0.5.5 +- Attempt at better handling file handles to fix windows bug regarding renaming .subscriptions.tmp +  0.5.4  - Improve error handling throughout the application (using error-chain) @@ -1,6 +1,6 @@  [package]  name = "podcast" -version = "0.5.4" +version = "0.5.5"  authors = ["Nathan Jaremko <njaremko@gmail.com>"]  description = "A command line podcast manager"  license = "GPL-3.0" @@ -12,16 +12,15 @@  - [x] Playing podcasts  - [x] Auto-download new episodes  - [x] Automatically check for updates -- [ ] Auto-delete old episodes  - [ ] Shell Completions      - [x] zsh      - [ ] bash      - [ ] sh  - [ ] Searching for podcasts...(WIP) -By default, podcasts are downloaded to $HOME/Podcasts, but this folder can be set with the $PODCASTS environmental variable. +By default, podcasts are downloaded to $HOME/Podcasts, but this folder can be set with the $PODCAST environmental variable. -How many latest episodes to download when subscibing to new podcasts can be set in the $PODCASTS/.config YAML file +How many latest episodes to download when subscibing to new podcasts can be set in the $PODCAST/.config YAML file  Downloads can be done a variety of ways: diff --git a/src/actions.rs b/src/actions.rs index 8adea4c..6a8951d 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -264,7 +264,9 @@ pub fn play_episode(state: &State, p_search: &str, ep_num_string: &str) -> Resul              if path.exists() {                  launch_player(path.to_str().chain_err(|| UNABLE_TO_CONVERT_TO_STR)?)?;              } else { -                launch_player(episode.url().chain_err(|| "unable to retrieve episode url")?)?; +                launch_player(episode +                    .url() +                    .chain_err(|| "unable to retrieve episode url")?)?;              }              return Ok(());          } diff --git a/src/main.rs b/src/main.rs index 35498df..4016199 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,7 @@ use utils::*;  use clap::{App, Arg, SubCommand}; -const VERSION: &str = "0.5.4"; +const VERSION: &str = "0.5.5";  fn main() -> Result<()> {      create_directories().chain_err(|| "unable to create directories")?; diff --git a/src/structs.rs b/src/structs.rs index 03a9932..0caed73 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -67,9 +67,11 @@ impl State {          path.push(".subscriptions");          if path.exists() {              let mut s = String::new(); -            let mut file = File::open(&path).chain_err(|| UNABLE_TO_OPEN_FILE)?; -            file.read_to_string(&mut s) -                .chain_err(|| UNABLE_TO_READ_FILE_TO_STRING)?; +            { +                let mut file = File::open(&path).chain_err(|| UNABLE_TO_OPEN_FILE)?; +                file.read_to_string(&mut s) +                    .chain_err(|| UNABLE_TO_READ_FILE_TO_STRING)?; +            }              let mut state: State = match serde_json::from_str(&s) {                  Ok(val) => val,                  // This will happen if the struct has changed between versions @@ -132,9 +134,11 @@ impl State {          let mut path = get_podcast_dir()?;          path.push(".subscriptions.tmp");          let serialized = serde_json::to_string(self).chain_err(|| "unable to serialize state")?; -        let mut file = File::create(&path).chain_err(|| UNABLE_TO_CREATE_FILE)?; -        file.write_all(serialized.as_bytes()) -            .chain_err(|| UNABLE_TO_WRITE_FILE)?; +        { +            let mut file = File::create(&path).chain_err(|| UNABLE_TO_CREATE_FILE)?; +            file.write_all(serialized.as_bytes()) +                .chain_err(|| UNABLE_TO_WRITE_FILE)?; +        }          fs::rename(&path, get_sub_file()?).chain_err(|| "unable to rename file")?;          Ok(())      } | 
