Page 1 of 1

[PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 2:30 pm
by IdeasVacuum
There seems to be a bug:

Code: Select all

sFile.s = "C:\PROJECTS\M100\HARDWARE INFO\IGSTK44\Testing\.NoDartCoverage"
Debug GetFilePart(sFile, #PB_FileSystem_NoExtension)
In this case, the file has no file name, only an extension, but the extension is returned as the file name.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 2:33 pm
by eddy
on linux, there's a kind of file:

Code: Select all

.htaccess
Is it a file name or a special extension ?

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 2:55 pm
by ts-soft
eddy wrote:on linux, there's a kind of file:

Code: Select all

.htaccess
Is it a file name or a special extension ?
This is a file name. The dot in front stays for hidden!

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 5:43 pm
by IdeasVacuum
Well, my example, .NoDartCoverage, is in fact a file name that has no extension and is preceded with a ".".

So, therefore this is not a PB bug. It is a pita though, because it chokes 7zip :?

I'll need to test each file name for this.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 7:52 pm
by jassing
IdeasVacuum wrote:Well, my example, .NoDartCoverage, is in fact a file name that has no extension and is preceded with a ".".
I read it as it's a filename that contains a blank name ("") and an extension.

In windows, dos, etc -- [filename] . [extension]

it gets more complicated if you have multiple periods, but we've always looked at it as the final '.' indicates the start of the extension.

This.Is.A.File.Name.With.Multiple.Periods

where "Periods"would be the extension. Treating it this way has proved trouble free....

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Aug 31, 2013 11:51 pm
by TassyJim
If you look at the file in Windows Explorer, it is described as a 'NoDartCoverage' file.
Windows treats it as an extension.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Wed Sep 04, 2013 9:18 pm
by IdeasVacuum
It's a build file for a cpp API, basically a text file containing one or two lines of text. Presumably for the process it belongs to, the naming is convenient. Certainly the info inside is nothing special. Would be interesting to see what Fred makes of it.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Thu Sep 05, 2013 12:47 am
by IdeasVacuum
Well, the plot thickens - I have several files of this type (they are not all ".NoDartCoverage").

I have discovered that RenameFile() fails to rename them

Code: Select all

sNewName$ = "new" + sOldName$
RenameFile(sOldName$, sNewName$)

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Thu Sep 05, 2013 1:20 pm
by acreis
I have made some experiences with windows explorer (WinXP), but I can't create a file with name in this format: ".extension" or ".filename".

Obviously "filename.extension" is OK.

It is possible that the system was not designed to accept a filename that contains only an extension, with no filename, or a filename with only one dot at its beggining is, by design, considered incorrect.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Thu Sep 05, 2013 2:03 pm
by JHPJHP
Hi acreis,

One way to "have" a filename with only an extension is to zip/rar a group of files, rename them using WinRAR or whatever software you use, then extract them to your desktop... or just use RenameFile (PureBasic) or MoveFile_ (Windows API) - both worked the same for the tests I performed.

I was able to rename (using scripts) to the standard naming convention, then back to "extension only" with no trouble using both functions.

---------------------------------------

Hi IdeasVacuum (stuff you probably know) :) ,

While testing - try to rename the files manually? A lot of the time, not being able to rename/delete a file is caused by an orphand process still having some type of lock.

A few "other" things to try:
Escape character: "C:\\Documents and Settings\\Administrator\\Desktop\\.test"
Forward slash: "C:/Documents and Settings/Administrator/Desktop/.test"
8.3 Short name: ""C:\Docume~1\Administrator\Desktop\test.txt"
Relative path: "./Desktop/.test"

Did not work for Rename / MoveFile_, but may work within 7-Zip (if any issues still exist):
#DQUOTE$ + "C:\Documents and Settings\Administrator\Desktop\test.txt" + #DQUOTE$

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Thu Sep 05, 2013 5:31 pm
by IdeasVacuum
It's 7z that does not like the files as-is. A common factor with these files is that they arrive with 'large' apps like CAD/CAM. So, seems likely that the developers of these apps are using the same or similar methods of packaging the apps, which usually have 100s of supporting files, including dll, exe, you name it.

None of the files are locked, I can re-name them manually and the text content remains intact. So, I'd like to know what Fred thinks.

Re: [PB5.20 Beta12] GetFilePart() #PB_FileSystem_NoExtension

Posted: Sat Jan 11, 2014 6:22 pm
by Demivec
IdeasVacuum wrote:Well, my example, .NoDartCoverage, is in fact a file name that has no extension and is preceded with a ".".

So, therefore this is not a PB bug. It is a pita though, because it chokes 7zip :?
I think it may still be a PB bug but the bug is with GetExtensionPart() and not GetFilePart().

What should this simple test display?

Code: Select all

Procedure testit(t.s)
  Debug "complete file name --" + t + "--"
  Debug "file part only --" + GetFilePart(t, #PB_FileSystem_NoExtension) + "--"
  Debug "extension part only --" + GetExtensionPart(t.s) + "--"
EndProcedure


testit(".NoDartCoverage")
In this example the file part shows ".NoDartCoverage" and the extension part shows "NoDartCoverage". I'll post a bug report regarding this problem with GetExtensionPart(), at least for windows.