View Full Version : found splitpath bug
limboo
08-07-2009, 10:48 AM
splitpath has a bug that renders it useless.
if you have a folder with a .(dot) eg folder.restoffolder
it will see that as the filename and the stuff after the dot as an extension
because splitpath reads from left to right it will think that the first thing that has a dot is the filename and the stuff after it an extension and then stops because you can only have 1 filename
so you will get this kind of situations
C:\\dir\\folder.restfolder\\filename.doc
splitpaths table will look like this
drive = C:\\
folder = dir
filename = folder
extension = restfolder
and then stops
IR please fix this with simply starting on the right.
also see my other bug thread http://www.indigorose.com/forums/showthread.php?t=27600
Ulrich
08-07-2009, 12:25 PM
Thanks. This issue has been entered into the database with ref. number 18860.
Ulrich
Imagine Programming
08-07-2009, 06:06 PM
Nice find, I never knew this lol. I'm writing a custom function now hehe (String.ReverseFind)
Ulrich, could we get an optional startposition in String.ReverseFind? So we could repeat the search in a loop from a certain point?
ShadowUK
08-08-2009, 03:53 AM
Nice find, I never knew this lol. I'm writing a custom function now hehe (String.ReverseFind)
Ulrich, could we get an optional startposition in String.ReverseFind? So we could repeat the search in a loop from a certain point?
Cough String.Mid, cough.
Imagine Programming
08-08-2009, 06:36 AM
Cough String.Mid, cough.
I was talking about a startposition in string.reversefind :p
I know I could use string.mid, but I 'd like this.
Hi Limbo,
What version of AutoPlay are you using? Also what does your code look like? I've tried to replicate this using the following code but it works for me:
Debug.ShowWindow(true); --Shows the debug window.
path_parts = String.SplitPath("C:\\dir\\folder.restfolder\\filename.doc");
Debug.Print("Drive: "..path_parts.Drive.."\r\n");
Debug.Print("Folder: "..path_parts.Folder.."\r\n");
Debug.Print("Filename: "..path_parts.Filename.."\r\n");
Debug.Print("Extension: "..path_parts.Extension.."\r\n");
The results are what I would expect:
Drive: C:
Folder: \dir\folder.restfolder\
Filename: filename
Extension: .doc
Is anyone else getting different results?
mark.
RizlaUK
09-24-2009, 05:19 AM
The results are what I would expect:
yup, me to
Drive: C:
Folder: \dir\folder.restfolder\
Filename: filename
Extension: .doc
even with some extreme dot notation it works as expected, there's no bug here
Debug.ShowWindow(true); --Shows the debug window.
path_parts = String.SplitPath("C:\\base.dir\\folder.rest.folder\\file.name.doc");
Debug.Print("Drive: "..path_parts.Drive.."\r\n");
Debug.Print("Folder: "..path_parts.Folder.."\r\n");
Debug.Print("Filename: "..path_parts.Filename.."\r\n");
Debug.Print("Extension: "..path_parts.Extension.."\r\n");
outputs
Drive: C:
Folder: \base.dir\folder.rest.folder\
Filename: file.name
Extension: .doc
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.