[Install] Do not crash when the directory is not found. (#7378)

This is NOT a fix for https://github.com/xamarin/maccore/issues/2053 but
a nice thing to have to make sure that when the file cannot be copied we
have a useful debugging message. Fixing
https://github.com/xamarin/maccore/issues/2053 should be done in the
path mangler that is doing something wrong with the paths.
This commit is contained in:
Manuel de la Pena 2019-11-06 16:09:02 -05:00 коммит произвёл GitHub
Родитель 0c1b9b9b03
Коммит 566e5a8d12
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -272,12 +272,18 @@ public class ListSourceFiles {
}
try {
File.Copy (fixedSource, target);
} catch (FileNotFoundException e) {
} catch (FileNotFoundException e) {
Console.WriteLine ("The file {0} could not be copied to {1} because the file does not exists: {2}", fixedSource, target, e);
Console.WriteLine ("Debugging info:");
Console.WriteLine ("\tSource is {0}", src);
Console.WriteLine ("\tFixed source is {0}", fixedSource);
Console.WriteLine ("\tPath mangler type is {0}", mangler.GetType().Name);
Console.WriteLine ("\tPath mangler type is {0}", mangler.GetType ().Name);
} catch (DirectoryNotFoundException e) {
Console.WriteLine ("The file {0} could not be copied to {1} because the dir does not exists: {2}", fixedSource, target, e);
Console.WriteLine ("Debugging info:");
Console.WriteLine ("\tSource is {0}", src);
Console.WriteLine ("\tFixed source is {0}", fixedSource);
Console.WriteLine ("\tPath mangler type is {0}", mangler.GetType ().Name);
} catch (PathTooLongException e) {
Console.WriteLine ("The file {0} could not be copied to {1} because the file path is too long: {2}", fixedSource, target, e);
return 1;