<commit_before>﻿using disk_usage;
using System;
using System.Windows.Forms;

namespace disk_usage_ui
{
    public static class Shortcuts
    {
        public static bool TryCreate(PathRecord record, bool notify = true)
        {
            try
            {
                //create shortcut

                string shortcutLocation = $"{Windows.Desktop}\\{record.ShortcutName} - Shortcut.lnk";

                Windows.CreateShortcut(record.Path, shortcutLocation);

                if (notify) MessageBox.Show($"A shortcut to \"{record.Path}\" was placed on your Desktop.");

                return true;
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("The directory could not be found, a shortcut cannot be created.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)<commit_msg>Need to catch ArgumentException for malformed path<commit_after>﻿using disk_usage;
using System;
using System.Windows.Forms;

namespace disk_usage_ui
{
    public static class Shortcuts
    {
        public static bool TryCreate(PathRecord record, bool notify = true)
        {
            try
            {
                //create shortcut

                string shortcutLocation = $"{Windows.Desktop}\\{record.ShortcutName} - Shortcut.lnk";

                Windows.CreateShortcut(record.Path, shortcutLocation);

                if (notify) MessageBox.Show($"A shortcut to \"{record.Path}\" was placed on your Desktop.");

                return true;
            }
            catch (Exception ex) when (ex is System.IO.FileNotFoundException || ex is ArgumentException)
            {
                MessageBox.Show("The directory could not be found, a shortcut cannot be created.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
{'fraction_non_alphanumeric': 0.08926673751328375, 'fraction_numerical': 0.0, 'mean_word_length': 2.046925566343042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5158450', 'n_tokens_mistral': 485, 'n_tokens_neox': 449, 'n_words': 135}