Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSupport => SaveFileService & OpenFileService: Bug if InitialDirectory does not exist #1453

Closed
Khashayar-Emami opened this issue Oct 22, 2019 · 5 comments · Fixed by #1459
Closed
Assignees
Labels
bug
Milestone

Comments

@Khashayar-Emami
Copy link

@Khashayar-Emami Khashayar-Emami commented Oct 22, 2019

// Type: Catel.Services.IFileSupport
// Assembly: Catel.MVVM, Version=5.10.0.0, Culture=neutral, PublicKeyToken=null

In FileSupport for SaveFileService & OpenFileService if the InitialDirectory does not exist, an exception is thrown. A possible fix was marked down:

public override IOpenFileService GetOpenFileService(string title, string filter, string initialDirectory = null, string fileNameSuggestion = null, bool isMultiSelect = false)
{
var service = IoCConfiguration.DefaultDependencyResolver.Resolve();
service.Title = title;
service.Filter = filter;
service.InitialDirectory = initialDirectory;
service.FileName = fileNameSuggestion;
service.IsMultiSelect = isMultiSelect;
service.CheckFileExists = true;

        ************// HERE THE FIX:************
        ************// HERE THE FIX:************
        if (!Directory.Exists(fileSupport.InitialDirectory))
        {
            fileSupport.InitialDirectory = null;
        }
        ************// END OFTHE FIX:************
        ************// END OF THE FIX:************

        return service;
    }

public override ISaveFileService GetSaveFileService(string title, string filter, string initialDirectory = null, string fileNameSuggestion = null)
{
var service = IoCConfiguration.DefaultDependencyResolver.Resolve();
service.Title = title;
service.Filter = filter;
service.InitialDirectory = initialDirectory;
service.FileName = fileNameSuggestion;
service.ValidateNames = true;

        ************// HERE THE FIX:************
        ************// HERE THE FIX:************
        if (!Directory.Exists(fileSupport.InitialDirectory))
        {
            fileSupport.InitialDirectory = null;
        }
        ************// END OFTHE FIX:************
        ************// END OF THE FIX:************

        return service;
    }

Thank you, kind regards
Khashayar Emami

@GeertvanHorrik

This comment has been minimized.

Copy link
Member

@GeertvanHorrik GeertvanHorrik commented Oct 22, 2019

Thanks for reporting. I think we can implement this for 5.12. We do have Orc.FileSystem which we prefer to do file / directory related operations, need to figure out how to deal with that (maybe make it virtual and override in Orchestra).

@GeertvanHorrik GeertvanHorrik self-assigned this Oct 22, 2019
@GeertvanHorrik GeertvanHorrik added this to the 5.12.0 milestone Oct 22, 2019
@Khashayar-Emami

This comment has been minimized.

Copy link
Author

@Khashayar-Emami Khashayar-Emami commented Oct 23, 2019

Thank you for that. Please notify me if the problem has been fixed in the new version.
Regards
Khashayar

@GeertvanHorrik

This comment has been minimized.

Copy link
Member

@GeertvanHorrik GeertvanHorrik commented Oct 24, 2019

We don't do notification stuff, not even for paying / supporting customers. We will close the ticket once it's done, that's all we can give with the resources we have.

@Khashayar-Emami

This comment has been minimized.

Copy link
Author

@Khashayar-Emami Khashayar-Emami commented Oct 25, 2019

Ok

@lock

This comment has been minimized.

Copy link

@lock lock bot commented Nov 4, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.