System.IO.DirectoryNotFoundException: Could not find a part of the path

Sascha Manns <[email protected]> Mon, 06 Feb 2017 13:14:37 +0100
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
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/[email protected]/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
       
      

      [email protected]

      GPG:
      0x168428cdb1f20ab1

      jabber:
      [email protected]
    

              
        
 Maifeldstraße 10

         56727 Mayen

        mobile: +49-1573-9242730

         home: +49-2651-4014045
        

        https://saigkill.tuxfamily.org
      

    
    
      
    
    
      
    
    
      
    
    
      
    
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    
      
    
    
      
    
    
    

    
  

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/mono-list
signature.asc (application/pgp-signature, 801 B)
-----BEGIN PGP SIGNATURE-----

iQIcBAABCAAGBQJYmGitAAoJEHUnY+i/qDos1twP/1AoZvagN5BXUnciSmw5zfu5
51JKTsEcqvQiLYMi3O2XrQurHEYCQ/yjjqYWGsl6Ctt5G020JB/0mHJ7JuDW9iJW
sofl5FzvRiODnJQpNDDmzNFnyrMZpF4WcdWUU9mjtgaQe8nAHeHPRUIsMeLaR5J9
eiWJeaTkeWztnWZcZQglMUVueZDkAhwUICSOZycIpHEazZgO2i6nYyrUPrJJX/kM
qbcftHiqkrem7oUrMe6WPlhcwoexmU9bwE2fxZGzyHJ21os1VGGj1bawY61mhuFC
IvikyCA/MEMg4WKlgNAmdXhe9hPyqW/5pI+wyW3HmR4zEYC+hAlJ2eUkLn9RFnIe
WDoYcbeDgzsByIvk+8Fje/s41qmlcZVO+/44FM9AnIlWBCQGTC7gmYpbKDAayIZ9
J2PJOz3xS4fOYMWxcR1/5SEfT1NYO6j+AuA0SvQYgVCiyKz0R4e2U5hnRWKwDj/e
nQkZoQdiQQEgytT0ExIzHWrvR8sOCJfH4YcBqkjTOjA/0n71RpG1EGWfF23WruZ0
OsTxP7oBHANn0HnCgG43Zs8pX79QH+s1PxVYCIvMn7EorQR9EZi/rK10/6wB/ndW
kOuZCgd+jjuqYRiKny1VqthdD/yAl7OCC2+ybVS/I9INlCZw/UcShH2dE0Tgz0e1
O/icS1HfYsVnDtOZrLHW
=j+oQ
-----END PGP SIGNATURE-----