Jim Brown Active Member Licensed User Longtime User Nov 23, 2013 #1 Running a simple console test app on Windows 7 the File.DirApp is returning the 'short' filename system but I need the long file system. Example: Code: Copy ' console app - Test File.DirXX output #Region Project Attributes #CommandLineArgs: #End Region Sub Process_Globals End Sub Sub AppStart (Args() As String) Log(File.DirApp) Log(File.DirTemp) End Sub Output: File.DirApp returns "D:\BASICJ~1\CONSOL~1\Objects" File.DirTemp returns "C:\Users\Owner\AppData\Local\Temp\" Can this be fixed so that File.DieApp returns the long file system method? Last edited: Nov 24, 2013
Running a simple console test app on Windows 7 the File.DirApp is returning the 'short' filename system but I need the long file system. Example: Code: Copy ' console app - Test File.DirXX output #Region Project Attributes #CommandLineArgs: #End Region Sub Process_Globals End Sub Sub AppStart (Args() As String) Log(File.DirApp) Log(File.DirTemp) End Sub Output: File.DirApp returns "D:\BASICJ~1\CONSOL~1\Objects" File.DirTemp returns "C:\Users\Owner\AppData\Local\Temp\" Can this be fixed so that File.DieApp returns the long file system method?
Olaan Expert Licensed User Longtime User Nov 23, 2013 #2 If I don't forget,Hotshoes' library can done. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Nov 23, 2013 #3 File.DirApp is based on a system property. It returns the value as is. In most cases it doesn't matter whether you hold the short name or the long name. You can use this code to get the full name: Code: Copy Sub GetCanonicalPath(Path As String) As String Dim fileO As JavaObject fileO.InitializeNewInstance("java.io.File", Array As Object(Path)) Return fileO.RunMethod("getCanonicalPath", Null) End Sub Upvote 0
File.DirApp is based on a system property. It returns the value as is. In most cases it doesn't matter whether you hold the short name or the long name. You can use this code to get the full name: Code: Copy Sub GetCanonicalPath(Path As String) As String Dim fileO As JavaObject fileO.InitializeNewInstance("java.io.File", Array As Object(Path)) Return fileO.RunMethod("getCanonicalPath", Null) End Sub
C coyote Member Licensed User Longtime User Feb 11, 2014 #4 When I open the windows explorer with: Code: Copy Sub mnu_explorer_Action Dim x As String = File.DirApp Log(GetCanonicalPath(x)) fx.ShowExternalDocument(File.GetUri(File.GetFileParent(x),"")) End Sub The explorer shows the "short version". Is there an other way to show the "long version"? Coyote Upvote 0
When I open the windows explorer with: Code: Copy Sub mnu_explorer_Action Dim x As String = File.DirApp Log(GetCanonicalPath(x)) fx.ShowExternalDocument(File.GetUri(File.GetFileParent(x),"")) End Sub The explorer shows the "short version". Is there an other way to show the "long version"? Coyote
margret Well-Known Member Licensed User Longtime User Feb 11, 2014 #5 This code returns the long filenames: Code: Copy Private fs As FileChooser Dim ans = fs.ShowOpen(MainForm) As String Log(ans) Upvote 0
This code returns the long filenames: Code: Copy Private fs As FileChooser Dim ans = fs.ShowOpen(MainForm) As String Log(ans)
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2014 #6 Code: Copy fx.ShowExternalDocument(File.GetUri(GetCanonicalPath(File.GetFileParent(x)),"")) Upvote 0
B B4JExplorer Active Member Licensed User Longtime User Apr 24, 2014 #7 Outside of the IDE, does DirApp return the folder name, where the jar is located? Inside the IDE, it returns the project root, plus the \Objects subfolder. I just want to make sure that the executable/jar location can be determined, because we're putting a configuration file in the same folder. Upvote 0
Outside of the IDE, does DirApp return the folder name, where the jar is located? Inside the IDE, it returns the project root, plus the \Objects subfolder. I just want to make sure that the executable/jar location can be determined, because we're putting a configuration file in the same folder.
Erel B4X founder Staff member Licensed User Longtime User Apr 24, 2014 #8 It returns the "working directory". If you double click on the jar file then it will return the jar file location. If you run it from command line then it will return the current directory (this means that you should first cd to the correct folder). Upvote 0
It returns the "working directory". If you double click on the jar file then it will return the jar file location. If you run it from command line then it will return the current directory (this means that you should first cd to the correct folder).
B B4JExplorer Active Member Licensed User Longtime User Apr 24, 2014 #9 Yep, understood, thanks. Upvote 0