You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✗ fsharpi
F# Interactive for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
> open System.IO;;
> new DirectoryInfo("~/dev");;
val it : DirectoryInfo =
~/dev {Attributes = 0;
CreationTime = 1/1/1601 1:00:00 AM;
CreationTimeUtc = 1/1/1601 12:00:00 AM;
Exists = false;
Extension = "";
FullName = "/Users/henrik.feldt/dev/haf/FsSql/~/dev";
LastAccessTime = 1/1/1601 1:00:00 AM;
LastAccessTimeUtc = 1/1/1601 12:00:00 AM;
LastWriteTime = 1/1/1601 1:00:00 AM;
LastWriteTimeUtc = 1/1/1601 12:00:00 AM;
Name = "dev";
Parent = /Users/henrik.feldt/dev/haf/FsSql/~;
Root = /;}
> let p = it;;
val p : DirectoryInfo = ~/dev
> p.FullPath;;
p.FullPath;;
^^^^^^^^^^
/Users/henrik.feldt/dev/haf/FsSql/stdin(4,1): error FS1097: The struct or class field 'FullPath' is not accessible from this code location
> p.FullName;;
val it : string = "/Users/henrik.feldt/dev/haf/FsSql/~/dev"
> p.GetFiles();;
System.IO.DirectoryNotFoundException: Directory '/Users/henrik.feldt/dev/haf/FsSql/~/dev' not found.
at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in <filename unknown>:0
at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0
at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00000] in <filename unknown>:0
at System.IO.DirectoryInfo.GetFiles () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:GetFiles ()
at <StartupCode$FSI_0007>.$FSI_0007.main@ () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Stopped due to error
So it mono doesn't understand that, right? How can we work around this?
On Feb 17, 2015 1:42 PM, "Henrik Feldt" [email protected] wrote:
✗ fsharpi
F# Interactive for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
open System.IO;;
new DirectoryInfo("/dev");;
val it : DirectoryInfo = /dev {Attributes = 0;
CreationTime = 1/1/1601 1:00:00 AM;
CreationTimeUtc = 1/1/1601 12:00:00 AM;
Exists = false;
Extension = "";
FullName = "/Users/henrik.feldt/dev/haf/FsSql//dev";
LastAccessTime = 1/1/1601 1:00:00 AM;
LastAccessTimeUtc = 1/1/1601 12:00:00 AM;
LastWriteTime = 1/1/1601 1:00:00 AM;
LastWriteTimeUtc = 1/1/1601 12:00:00 AM;
Name = "dev";
Parent = /Users/henrik.feldt/dev/haf/FsSql/;
Root = /;}
let p = it;;
val p : DirectoryInfo = ~/dev
p.FullPath;;
p.FullPath;;
^^^^^^^^^^
/Users/henrik.feldt/dev/haf/FsSql/stdin(4,1): error FS1097: The struct or class field 'FullPath' is not accessible from this code location
p.FullName;;
val it : string = "/Users/henrik.feldt/dev/haf/FsSql//dev"
p.GetFiles();;
System.IO.DirectoryNotFoundException: Directory '/Users/henrik.feldt/dev/haf/FsSql//dev' not found.
at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in :0
at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in :0
at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in :0
at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00000] in :0
at System.IO.DirectoryInfo.GetFiles () [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:GetFiles ()
at <StartupCode$FSI_0007>.$FSI_0007.main@ () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
Stopped due to error
—
Reply to this email directly or view it on GitHub #612 (comment).
Activity
forki commentedon Feb 17, 2015
mhm do you know if this works with the default .NET DirectoryInfo class?
haf commentedon Feb 17, 2015
forki commentedon Feb 17, 2015
So it mono doesn't understand that, right? How can we work around this?
On Feb 17, 2015 1:42 PM, "Henrik Feldt" [email protected] wrote:
haf commentedon Feb 17, 2015
Regex.Replace("^~", Environment.GetSpecialDirectory(SpecialDirectories.HomeDirectory))?haf commentedon Feb 17, 2015
Another workaround: use the
HOMEenv var http://stackoverflow.com/a/3291314/63621forki commentedon Feb 17, 2015
I tested it on windows and it used my home dir. please give it a try.
haf commentedon Feb 17, 2015
Works nicely ;)