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

Sascha Manns Sascha.Manns at mailbox.org
Mon Feb 6 12:14:37 UTC 2017


Currently i'm using that method which should read text from a file and
write the content to another place:

private static void AddEntities(string environment, string
businessGlobalEntitiesFile, string entityfileLocal)
{    
    if (environment != "Work") return;
    if (businessGlobalEntitiesFile == null) return;
    var entities = File.ReadAllText(businessGlobalEntitiesFile);
    var separator = "<!-- COMMON ENTITIES -->" +
System.Environment.NewLine;
    File.WriteAllText(entityfileLocal, separator);
    File.WriteAllText(entityfileLocal, entities);
}

After building the solution and running the app i'm getting:

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException
to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.IO.DirectoryNotFoundException: Could not find a part of the path
"/home/sascha/saigkill at googlemail.com/Dokumente/publican-
xcom/articles/Test2/de-DE/Test2.ent".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode
mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.Boolean anonymous,
System.IO.FileOptions options) [0x001cf] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode
mode, System.IO.FileAccess access, System.IO.FileShare share,
System.Int32 bufferSize, System.IO.FileOptions options, System.String
msgPath, System.Boolean bFromProxy, System.Boolean useLongPath,
System.Boolean checkHost) [0x00000] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int
,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamWriter.CreateFile (System.String path,
System.Boolean append, System.Boolean checkHost) [0x00022] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean
append, System.Text.Encoding encoding, System.Int32 bufferSize,
System.Boolean checkHost) [0x00061] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean
append, System.Text.Encoding encoding, System.Int32 bufferSize)
[0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean
append, System.Text.Encoding encoding) [0x00000] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor
(string,bool,System.Text.Encoding)
  at System.IO.File.WriteAllText (System.String path, System.String
contents, System.Text.Encoding encoding) [0x00000] in
<8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.File.WriteAllText (System.String path, System.String
contents) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at PublicanCreators.Core.Publication.AddEntities (System.String
environment, System.String businessGlobalEntitiesFile, System.String
entityfileLocal) [0x0004c] in
/home/sascha/RiderProjects/PublicanCreators/src/PublicanCreators.Core/P
ublication.cs:290 

The target file Test2.ent exists and also the source textfile.

The full sourcecode of that projects are visible there: https://github.
com/saigkill/PublicanCreators/tree/master/src.

Greetings
Sascha
-- 


    
        
            

        
    
    Sascha Manns
       
      

      Sascha.Manns at mailbox.org

      GPG:
      0x168428cdb1f20ab1

      jabber:
      Sascha.Manns at jabber.org
    

              
        
 Maifeldstraße 10

         56727 Mayen

        mobile: +49-1573-9242730

         home: +49-2651-4014045
        

        https://saigkill.tuxfamily.org
      

    
    
      
    
    
      
    
    
      
    
    
      
    
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    

    
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20170206/19279c29/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20170206/19279c29/attachment.sig>


More information about the Mono-list mailing list