|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
mono- Creating new directory on CentOSHi All,
I am again here with my new problem.. Kindly help me to rectify my problem.
Scenario: I want to create a directory named as MyDir in /home/ directory using C# code. I am using CentOS. My Code is here:
using System; using System.Collections.Generic; using System.IO; using System.Text;
namespace Folder { class Program { static void Main(string[] args) { // Specify the directory you want to manipulate. string path = @"\home\MyDir"; try { // Determine whether the directory exists. if (Directory.Exists(path)) { Console.WriteLine("That path exists already."); Console.ReadLine(); return; }// Try to create the directory. DirectoryInfo di = Directory.CreateDirectory(path); Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("The process failed: {0}", e.ToString()); Console.ReadLine(); } finally {} } } }
I compile my code like in this way: [localdomain Folder]# gmcs Program.cs -r:System.dll
Compiling gives: Program.cs(23,31): warning CS0219: The variable `di' is assigned but its value is never used Compilation succeeded - 1 warning(s)
When I run My Code using mono like:
[localdomain Folder]# mono Program.exe
Its Gives:
The process failed: System.IO.IOException: Win32 IO returned 25. Path: \home\MyDir at System.IO.Directory.Exists (System.String path) [0x00000] at Folder.Program.Main (System.String[] args) [0x00000]
when I run my code on windows machine with different dir path i.e. c:\MyDir, its working fine.
Kindly help me..
Thanks A lot….
LEGAL DISCLAIMER
_______________________________________________ Monodevelop-list mailing list Monodevelop-list@... http://lists.ximian.com/mailman/listinfo/monodevelop-list |
|
|
Re: mono- Creating new directory on CentOSPath suppose to be,
string path = @"/home/MyDir"; -- Karthikeyan R -----Original Message----- From: monodevelop-list-bounces@... [mailto:monodevelop-list-bounces@...] On Behalf Of Amna Abbasi Sent: Thursday, October 22, 2009 11:58 AM To: monodevelop-list@... Subject: [MonoDevelop] mono- Creating new directory on CentOS Hi All, I am again here with my new problem.. Kindly help me to rectify my problem. Scenario: I want to create a directory named as MyDir in /home/ directory using C# code. I am using CentOS. My Code is here: using System; using System.Collections.Generic; using System.IO; using System.Text; namespace Folder { class Program { static void Main(string[] args) { // Specify the directory you want to manipulate. string path = @"\home\MyDir"; try { // Determine whether the directory exists. if (Directory.Exists(path)) { Console.WriteLine("That path exists already."); Console.ReadLine(); return; }// Try to create the directory. DirectoryInfo di = Directory.CreateDirectory(path); Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("The process failed: {0}", e.ToString()); Console.ReadLine(); } finally {} } } } I compile my code like in this way: [localdomain Folder]# gmcs Program.cs -r:System.dll Compiling gives: Program.cs(23,31): warning CS0219: The variable `di' is assigned but its value is never used Compilation succeeded - 1 warning(s) When I run My Code using mono like: [localdomain Folder]# mono Program.exe Its Gives: The process failed: System.IO.IOException: Win32 IO returned 25. Path: \home\MyDir at System.IO.Directory.Exists (System.String path) [0x00000] at Folder.Program.Main (System.String[] args) [0x00000] when I run my code on windows machine with different dir path i.e. c:\MyDir, its working fine. Kindly help me.. Thanks A lot.... ________________________________ LEGAL DISCLAIMER This e-mail is confidential and is for the use of the intended addressee only. If you are not the intended addressee, you may not copy, disseminate or otherwise act on this e-mail or its contents. Please contact the sender as quickly as possible. No email received from ITSec or its subsidiaries may bind the company in any contract or grant any rights to any recipient or third party. The views of the author do not necessarily reflect those of the company. http://www.eitsec.co.uk ________________________________ DISCLAIMER: This email message and all attachments are confidential and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or to mailadmin@... and destroy the original message. Opinions, conclusions, and other information in this message that do not relate to the official business of SPAN, shall be understood to be neither given nor endorsed by SPAN. _______________________________________________ Monodevelop-list mailing list Monodevelop-list@... http://lists.ximian.com/mailman/listinfo/monodevelop-list |
| Free embeddable forum powered by Nabble | Forum Help |