Hi!
I've seen that FS takes as a file extension everything after the first dot, instead of the last one. Now, that conflicts with the naming we are using for our files: - changesets and fileouts often take the form something.cs, something.1.cs, something.2.cs - image names: pharo-2.0.image, pharo-2.0.1.image One of them has to be changed I think... :) Also, I'm more used to the other definition of extension: All after the last dot :S Guille |
indeed this is a bit tricky... but what can you explicitely say :/
foo.tar foo.tar.gz foo.1.tar foo.1.tar.gz it's rather hard to decide which is the real extension and which one not :) so it might make sense to define a couple of test cases to see what we want (and maybe compare it to ruby / python / java) maybe we can add at least an #extensions method returning a list or so. If you check `man basename` you can pass explicitly an extension name to be stripped away from the full basename. maybe that's a better strategy? we should definitely find a solution for this! On 2012-06-17, at 19:43, Guillermo Polito wrote: > Hi! > > I've seen that FS takes as a file extension everything after the first dot, > instead of the last one. > > Now, that conflicts with the naming we are using for our files: > > - changesets and fileouts often take the form something.cs, something.1.cs, > something.2.cs > - image names: pharo-2.0.image, pharo-2.0.1.image > > One of them has to be changed I think... :) > > Also, I'm more used to the other definition of extension: All after the > last dot :S > > Guille |
On Sun, Jun 17, 2012 at 4:50 PM, Camillo Bruni <[hidden email]> wrote:
indeed this is a bit tricky... but what can you explicitely say :/ Why not #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: [:thing| thing extension] => #('' 'tar' 'gz' 'tar' 'gz')
and #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: [:thing| thing extensions] => #(#() #('tar') #('gz' 'tar') #('tar' '1') #('gz' 'tar' '1'))or
#('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: [:thing| thing extensions] => #(#() #('tar') #('tar' 'gz') #('1' 'tar') #('1' 'tar' 'gz')) ? foo.1.tar.gz is still (supposedly) gzipped data. foo.1.tar is still (supposedly) a tar file. so it might make sense to define a couple of test cases to see what we want best, Eliot |
Administrator
|
Sounds good.
Cheers,
Sean |
yep.
extension should be the thing after _last_ dot. On 18 June 2012 02:35, Sean P. DeNigris <[hidden email]> wrote: > > Eliot Miranda-2 wrote >> >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extension] => #('' 'tar' 'gz' 'tar' 'gz') >> and >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extensions] => #(#() #('tar') #('gz' 'tar') #('tar' '1') >> #('gz' 'tar' '1')) >> or >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extensions] => #(#() #('tar') #('tar' 'gz') #('1' 'tar') >> #('1' 'tar' 'gz')) >> > > Sounds good. > > -- > View this message in context: http://forum.world.st/FileSystem-and-file-extensions-tp4635256p4635293.html > Sent from the Pharo Smalltalk mailing list archive at Nabble.com. > -- Best regards, Igor Stasenko. |
In reply to this post by Camillo Bruni-3
On 18 June 2012 01:50, Camillo Bruni <[hidden email]> wrote: indeed this is a bit tricky... but what can you explicitely say :/ Nice example. File extension is always after the last dot. Milan Mimica http://sparklet.sf.net |
Administrator
|
In reply to this post by Eliot Miranda-2
I opened an issue (http://code.google.com/p/pharo/issues/detail?id=6091)... which order do we like for extensions?
Cheers,
Sean |
On 2012-06-20, at 06:45, Sean P. DeNigris wrote: > > Eliot Miranda-2 wrote >> >> Why not >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extension] => #('' 'tar' 'gz' 'tar' 'gz') >> and >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extensions] => #(#() #('tar') #('gz' 'tar') #('tar' '1') >> #('gz' 'tar' '1')) >> or >> #('foo' 'foo.tar' 'foo.tar.gz' 'foo.1.tar' 'foo.1.tar.gz') collect: >> [:thing| thing extensions] => #(#() #('tar') #('tar' 'gz') #('1' 'tar') >> #('1' 'tar' 'gz')) >> ? >> > > I opened an issue (http://code.google.com/p/pharo/issues/detail?id=6091)... > which order do we like for extensions? I'd say in the order they appear in the full basename, that will avoid confusion :) |
+1
>> >> I opened an issue (http://code.google.com/p/pharo/issues/detail?id=6091)... >> which order do we like for extensions? > > I'd say in the order they appear in the full basename, that will avoid > confusion :) > |
Administrator
|
What happened with this issue?! I see that extension still returns all the "extensions", even though there was consensus in the mailing list that the extension was the thing after the last dot.
I strongly disagree with this choice. Besides the fact that it breaks everything (can't recognize mcz's, st's), how about this: 'MyPackage.1.mcz'. Is 1 an extension?! No!!! Please reconsider... Cheers, Sean
Cheers,
Sean |
On 2012-06-22, at 18:45, Sean P. DeNigris wrote: > What happened with this issue?! I see that extension still returns all the > "extensions", even though there was consensus in the mailing list that the > extension was the thing after the last dot. > > I strongly disagree with this choice. Besides the fact that it breaks > everything (can't recognize mcz's, st's), how about this: 'MyPackage.1.mcz'. > Is 1 an extension?! No!!! Please reconsider... that is awkward :) we did a fix according to the previous posts ;), nah we just don't know how to program :P => reopen the issue! |
Administrator
|
Ha ha, I wrote that after spending waaay to many hours at the computer. I took a long bike ride and feel much better now :)
Cheers,
Sean |
In reply to this post by Camillo Bruni-3
So we fucked up a bit :).
What is the exact problem? Stef >> What happened with this issue?! I see that extension still returns all the >> "extensions", even though there was consensus in the mailing list that the >> extension was the thing after the last dot. >> >> I strongly disagree with this choice. Besides the fact that it breaks >> everything (can't recognize mcz's, st's), how about this: 'MyPackage.1.mcz'. >> Is 1 an extension?! No!!! Please reconsider... > > that is awkward :) > > we did a fix according to the previous posts ;), nah we just don't know > how to program :P > > => reopen the issue! |
Administrator
|
Status: NextActionNeeded
If we want to make #extension the part after the last extension delimiter, there's a fix in the inbox... Then we would have (e.g. "CommandShell-Piping-dtl.10.mcz": - #basename -> CommandShell-Piping-dtl.10.mcz "the entire name" - #base -> CommandShell-Piping-dtl "the part before any extension delimiters" - #basenameWithoutExtension -> CommandShell-Piping-dtl.10 "the part before the last extension - #extension -> mcz "the last extension" - #extensions -> an OrderedCollection('10' 'mcz') That seems like every conceivable interesting combination n.b. this slice is not related to the first one for this issue, which has already been integrated. I successfully loaded it into #20156 and updated the FS tests, which all pass SLICE-Issue-6091-FileReferencegtgtextension-should-be-after-last-separator-SeanDeNigris.1 Make #extension in FS return the part after the last extension delimiter
Cheers,
Sean |
Free forum by Nabble | Edit this page |