[Mono-list] System.IO.DirectoryNotFoundException: Could not find a part of the path

Andres knocte at gmail.com
Tue Feb 7 01:57:23 UTC 2017


On Tuesday, February 07, 2017 05:53 AM, Sascha Manns wrote:
> Am Montag, den 06.02.2017, 14:36 +0100 schrieb Sascha Manns:
>> I removed now the relative path from EntityfileLocal and used:
>>
>> private static string ProjectDir => Targetdir + Path.DirectorySeparatorChar + PublicationTitle +
>>                                     Path.DirectorySeparatorChar + Language + Path.DirectorySeparatorChar;
>>
>> Directory.SetCurrentDirectory(ProjectDir); // is in that case /home/sascha/Dokumente/publican-xcom/articles/Test/de-DE/
>>
>> The directory is created in the method before that one and it's filled:
>>
>> sascha at sascha-desktop
>> <mailto:sascha at sascha-desktop>:~/Dokumente/publican-xcom/articles/Test/de-DE$
>> ls
>> Article_Info.xml  Author_Group.xml  images  Revision_History.xml  Test.ent  Test.xml
>>
>> But after SetCurrentDirectory i'm getting:
>>
>> System.IO.DirectoryNotFoundException: Directory
>> "/home/sascha/Dokumente/publican-xcom/articles/Test/de-DE/" not found
>>
>> The directory is in my /home/sascha and it's writable and accessable.
> I found out something. The last method which will be executed before my
> try to access with Directory.SetCurrentDirectory is:
>
> private static void CreateDocu(string createstring)
> {
>     var startInfo = new ProcessStartInfo
>     {
>         FileName = @"/usr/bin/publican",
>         Arguments = @"" + createstring
>     };
>     Process.Start(startInfo);
> }
>
>
> This process creates the needed directories and it looks like my program
> doesn't wait for finishing the started process.

How about:

var proc = Process.Start(startInfo);
proc.WaitForExit();




More information about the Mono-list mailing list