fn init_activity_file(path: &Path) -> Result<File> {
    if path.exists() {
        return Ok(OpenOptions::new().append(true).open(path)?);
    }

    let mut file: File = OpenOptions::new().create(true).write(true).open(path)?;

    writeln!(
        &mut file,
        "\
{}
# List of recorded activities for the 'naday' tool (https://github.com/creinig/naday)
# Lines beginning with '#' are comments and are ignored by the tool
# The remaining lines are plain CSV, with one recorded activity per line.
# Separator character is ';', encoding is UTF-8.
# Columns: timestamp (local time zone) ; number of repetitions ; category (excercise)",
        PREAMBLE_ACTIVITIES_V1
    )?;

    Ok(file)
}
/// Open the activity file for the given timestamp.
/// If it doesn't exist, initialize it
Open the activity file for the given timestamp.
If it doesn't exist, initialize it
Open the activity file for the given timestamp . If it doesn ' t exist initialize it
fn init_activity_file(path: &Path) -> Result<File> {
    if path.exists() {
        return Ok(OpenOptions::new().append(true).open(path)?);
    }
    let mut file: File = OpenOptions::new().create(true).write(true).open(path)?;
    writeln!(
        &mut file,
        "\
{}
# List of recorded activities for the 'naday' tool (https://github.com/creinig/naday)
# Lines beginning with '#' are comments and are ignored by the tool
# The remaining lines are plain CSV, with one recorded activity per line.
# Separator character is ';', encoding is UTF-8.
# Columns: timestamp (local time zone) ; number of repetitions ; category (excercise)",
        PREAMBLE_ACTIVITIES_V1
    )?;
    Ok(file)
}
fn init_activity_file ( path : & Path ) -> Result < File > { if path . exists ( ) { return Ok ( OpenOptions :: new ( ) . append ( true ) . open ( path ) ? ) ; } let mut file : File = OpenOptions :: new ( ) . create ( true ) . write ( true ) . open ( path ) ? ; writeln ! ( mut file " \
 " PREAMBLE_ACTIVITIES_V1 ) ? ; Ok ( file ) }
Open the activity file for the given timestamp.
Open the activity file for the given timestamp .
path
&Path