Skip to main content



      Home
Home » Modeling » TMF (Xtext) » difference in IFileSystemAccess.generateFile between Linux and Windows????
difference in IFileSystemAccess.generateFile between Linux and Windows???? [message #1378112] Sat, 24 May 2014 00:50 Go to next message
Eclipse UserFriend
I've transferred (painfully) my Xtext/Xtend DSL project from Windows to Linux.

Now I'm finding that my code generation is working differently.


override void doGenerate(Resource resource, IFileSystemAccess fsa) {
var pkage = "\\com\\holycityaudio\\SpinCAD\\CADBlocks\\"
fsa.generateFile(pkage + resource.className+"CADBlock.java", toCADBlockCode(resource.contents.head as Program))
}

On my Windows systems, this created a package com.holycityaudio.SpinCAD.CADBlocks and created the file resource.className+"CADBlock.java" within that package.

On Linux, it is creating a file with the name:

"\com\holycityaudio\SpinCAD\CADBlocks\"+resource.className+"CADBlock.java"

and putting it in the default package. Well of course the rest of my code doesn't actually like this.

What's going on and how can I fix it?

GW


[Updated on: Sat, 24 May 2014 00:52] by Moderator

Re: difference in IFileSystemAccess.generateFile between Linux and Windows???? [message #1378130 is a reply to message #1378112] Sat, 24 May 2014 01:05 Go to previous messageGo to next message
Eclipse UserFriend
OK, well as I finally remembered, folder slashes go in a different direction on Linux than Windows. So I had to change this

var pkage = "\\com\\holycityaudio\\SpinCAD\\CADBlocks\\"

to this:

var pkage = "/com/holycityaudio/SpinCAD/CADBlocks/"

Of course, I'd like to find a way to make this OS independent. Any ideas?

[Updated on: Sun, 25 May 2014 10:27] by Moderator

Re: difference in IFileSystemAccess.generateFile between Linux and Windows???? [message #1378323 is a reply to message #1378130] Sat, 24 May 2014 03:02 Go to previous messageGo to next message
Eclipse UserFriend
hi,

using / should work on both windown and linux
Re: difference in IFileSystemAccess.generateFile between Linux and Windows???? [message #1381367 is a reply to message #1378323] Sun, 25 May 2014 10:19 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you can use
"/com/holycityaudio/SpinCAD/CADBlocks/".replace("/", System.getProperty("file.separator"))

So you are compatible even to old Windows versions, which understood only \ but not yet /
Re: difference in IFileSystemAccess.generateFile between Linux and Windows???? [message #1381384 is a reply to message #1381367] Sun, 25 May 2014 10:26 Go to previous message
Eclipse UserFriend
Thanks for the info. I don't think I'm going any further back than Windows 7.
Previous Topic:[SOLVED] Validation errors when trying to launch Eclipse Application
Next Topic:Deploy xtext plugin and install the correct version of xtext automatically in the client
Goto Forum:
  


Current Time: Wed Jul 23 21:24:28 EDT 2025

Powered by FUDForum. Page generated in 0.05546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top