Jump to content

Recommended Posts

Posted

[quote name='cherlapalli_jailer' timestamp='1344611606' post='1302288860']
help
[/quote]
S%Hi ltt

Posted

file [color=#66cc66]=[/color] [color=#000000][b]new[/b][/color] [color=#aaaadd][b]File[/b][/color][color=#66cc66]([/color][color=#ff0000]'yourfile.txt'[/color][color=#66cc66])[/color]
[color=#993399]println[/color] file.[color=#006600]canonicalPath[/color]


[color=#006600]google :hiding:[/color]

Posted

[quote name='dennis' timestamp='1344611798' post='1302288884']
file [color=#66cc66]=[/color] [color=#000000][b]new[/b][/color] [color=#aaaadd][b]File[/b][/color][color=#66cc66]([/color][color=#ff0000]'yourfile.txt'[/color][color=#66cc66])[/color]
[color=#993399]println[/color] file.[color=#006600]canonicalPath[/color]


[color=#006600]google :hiding:[/color]
[/quote]

tried it full path ivvatle :( :3D_Smiles_38:

Posted

edo plug in kavali ani vastunnadi goggling lo

Posted

try this

file = new File("filename.txt")
println file.parentFile.absolutePath

Posted

[quote name='dennis' timestamp='1344611798' post='1302288884']
file [color=#66cc66]=[/color] [color=#000000][b]new[/b][/color] [color=#aaaadd][b]File[/b][/color][color=#66cc66]([/color][color=#ff0000]'yourfile.txt'[/color][color=#66cc66])[/color]
[color=#993399]println[/color] file.[color=#006600]canonicalPath[/color]


[color=#006600]google :hiding:[/color]
[/quote]
[quote name='Thingarodu' timestamp='1344613153' post='1302289062']
try this

file = new File("filename.txt")
println file.parentFile.absolutePath
[/quote]

both of them working if I make few changes while Initializing my file S%Hi S%Hi S%Hi

Posted

what changes you made to the initialization part to make it work? It will be useful for others if you mention that....

Posted

[b]Ken Graham[/b]
[color=#000000][font=verdana, sans-serif][size=3]
First - both Absolute and Canonical forms are OS dependent per the API documentation forjava.io.File.[/size][/font][/color][color=#000000][font=verdana, sans-serif][size=3]
Second - Absolute is not absolute. It is not a resolved path name. If File f is not already an absolute path name, according to OS dependent rules, then it simply prepends the value ofSystem.getProperty("user.dir"). However, don't think that you can usesetProperty("user.dir",otherdir), because it will be ignored under Windows. At some future point Sun may change their mind regarding this. :-)))))[/size][/font][/color][color=#000000][font=verdana, sans-serif][size=3]
Thirdly - Canonical is resolved, but in an OS dependent form.[/size][/font][/color][color=#000000][font=verdana, sans-serif][size=3]
Therefore, if you want to really know about the name of the file avoid either of these two methods, and use File.toURL().toExternalForm() instead. The form is resolved, and in an OS Independent way, so you can write code that is Write Once Run Anywhere.[/size][/font][/color]

[color=#000000][font=verdana, sans-serif][size=3]
when used Absolutepath or canonicalPath the output of the path is /Users/UserName/Documents/Projects/filename.xml[/size][/font][/color][color=#000000][font=verdana, sans-serif][size=3]
so when initilaizing the filename I added the project structure ("projectname/trunk/src/test/resources.filename.xml")[/size][/font][/color][color=#000000][font=verdana, sans-serif][size=3]
then it outputting the complete path /Users/UserName/Documents/Projects/projectname/trunk/src/test/resources.filename.xml[/size][/font][/color]

Posted

I use groovy in Saopui for testing purpose....intha vasaram raledu....u guys are dev's or QA?

Posted

[quote name='CQ5' timestamp='1344616502' post='1302289429']
[b]Ken Graham[/b]

[color=#000000][font=verdana, sans-serif][size=3]First - both Absolute and Canonical forms are OS dependent per the API documentation forjava.io.File.[/size][/font][/color]
[color=#000000][font=verdana, sans-serif][size=3]Second - Absolute is not absolute. It is not a resolved path name. If File f is not already an absolute path name, according to OS dependent rules, then it simply prepends the value ofSystem.getProperty("user.dir"). However, don't think that you can usesetProperty("user.dir",otherdir), because it will be ignored under Windows. At some future point Sun may change their mind regarding this. :-)))))[/size][/font][/color]
[color=#000000][font=verdana, sans-serif][size=3]Thirdly - Canonical is resolved, but in an OS dependent form.[/size][/font][/color]
[color=#000000][font=verdana, sans-serif][size=3]Therefore, if you want to really know about the name of the file avoid either of these two methods, and use File.toURL().toExternalForm() instead. The form is resolved, and in an OS Independent way, so you can write code that is Write Once Run Anywhere.[/size][/font][/color]


[color=#000000][font=verdana, sans-serif][size=3]when used Absolutepath or canonicalPath the output of the path is /Users/UserName/Documents/Projects/filename.xml[/size][/font][/color]
[color=#000000][font=verdana, sans-serif][size=3]so when initilaizing the filename I added the project structure ("projectname/trunk/src/test/resources.filename.xml")[/size][/font][/color]
[color=#000000][font=verdana, sans-serif][size=3]then it outputting the complete path /Users/UserName/Documents/Projects/projectname/trunk/src/test/resources.filename.xml[/size][/font][/color]
[/quote]

thankyou

×
×
  • Create New...