Repository navigation
Broken custom source from file system #612
Description
Activity
mhm do you know if this works with the default .NET DirectoryInfo class?
✗ 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 errorSo it mono doesn't understand that, right? How can we work around this?
On Feb 17, 2015 1:42 PM, "Henrik Feldt" notifications@github.com wrote:✗ fsharpi
F# Interactive for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source LicenseFor help type #help;;
open System.IO;;
new DirectoryInfo("/dev");;;
val it : DirectoryInfo =
/dev {Attributes = 0;/dev";
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/
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"/dev' not found.
p.GetFiles();;
System.IO.DirectoryNotFoundException: Directory '/Users/henrik.feldt/dev/haf/FsSql/
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).Regex.Replace("^~", Environment.GetSpecialDirectory(SpecialDirectories.HomeDirectory))?Another workaround: use the
HOMEenv var http://stackoverflow.com/a/3291314/63621I tested it on windows and it used my home dir. please give it a try.
Works nicely ;)
Trying to create a custom nuget source from the file system, getting this:
`