What file name convention should I use when uploading a text file of Objectscript on an Apple mac?

Hi,

I have an Atelier question.

I have a routine developed in Studio to upload a tab-delimited text file to process using Objectscript into Cache.

In Windows, to upload the file “test.txt”, I used the Objectscript commands,

      Set uploadfilename = “c/testdata/RNAseq/GDC download 11-19-17/GDC download 11-19-17 counts/GDC download 11-19-17 unzipped/test.txt”
      set file = ##class(%Stream.FileCharacter).%New()
      set file.Filename = uploadfilename  ; pass in the file name of the file you want to open.

How should this be done on a mac?

Should I use the UNIX,

   Set uploadfilename = “\Users\peterpiper\Desktop\testdata\RNAseq\GDC download 11-19-17\GDC download 11-19-17 counts\GDC download 11-19-17 unzipped\test.txt”

Or, the mac OS style,

  Set uploadfilename ="Macintosh HD:Users:robertharris:Desktop:testdata:RNAseq:GDC download 11-19-17:GDC download 11-19-17 counts:GDC download 11-19-17 unzipped:test.txt”

Or something else to upload a text file into Cache using %Stream.FileCharacter?

Thanks,

Bob Harris

  • 0
  • 0
  • 169
  • 5
  • 2

Answers

slash macro:

#if $$$isWINDOWS
///
    #define slash "\"
#else
///
    #define slash "/"
#endIf

That said, consider using %File API  to work with file names. I usually extract "storage directory" as an application-wide setting (normalized and validated on change) and just add a file name. This way user code can ignore most OS path differences.

In first you used wrong slashes for windows and macOS. For windows should be "\" and for macOS "/"

For macOS you should use Unix style, where did you find this macOS style with colons? I have never seen such way.

And do not forget, that you can use methods NormalizeFilename and NormalizeDirectory in the class %File. These methods can help you to fix platform differences.

Sorry for the typos. Posting at 3:00 am in the morning is not always best practice...

While I've been using my mac for 6 years, I only briefly tried Applescript as a workaround late last year, while waiting for Atelier beta 1.1 to be released. After looking at several books on Applescript and Apple's own Applescript website, it was clear that the only acceptable file naming protocol was the the colon-delimited protocol, of which I posted a working example and has worked several Apple apps.

It was new to me, too, but to my knowledge, this is what mac apps operating in OS X require.

Thanks for the tips.

Best,

Bob Harris

Comments

I have an Atelier question.

How's that Atelier-related though?

Because I'm developing using Atelier on mac, rather than Studio in Windows.

As I import projects from Windows/Studio into mac/Atelier, it's not clear where differences might be. I looked through the documentation, but found no examples for this.

In Applescript, and presumably, in Swift, you have to use the colon notation. The documentation I found said this was the standard for OS X applications. This suggests to me that if file is being read by Atelier as an OS X app, you need to use the colon notation. On the other hand, if the file is being read by Atelier at the Apple UNIX level, you need to use UNIX file system notation.

You might be interested to know that not all UNIX commands are available to the apple user, even when signed in as root. Since I don't know which paths the Atelier developers took to make things work, I posted my question.

 

 

It does not matter where you edit your code, only matter where your Caché server installed. Because all code will be executed only on the server, not on your machine. And if you installed Caché on your mac as well, so, you should use UNIX way for the path.