Page 1 of 1

Help with Install on mac

Posted: Thu Apr 19, 2018 8:04 am
by collectordave
Probably a simply question answered hundreds of times.


Created my app on the Mac works very well when started from the IDE.

When I use create executable it is created in the right place but does not run properly.



How do i create a dmg file for the whole application.

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 8:15 am
by Fred
Did you append the '.app' at your filename when using 'Create Executable' ?

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 8:26 am
by collectordave
.App appended

My app still does not work.

Very simple app created and it works so must be a problem with my application somewhere.

Created folder in Documents to hold app and all its files. Compiled app and checked it appears that GetCurrentDirectory() returns nothing. The simple App is just a message requester that returns the current directory and that appears to work.

Will look a little deeper.

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 8:37 am
by collectordave
Quick update

Trawled memory (Mine) and remembered on mac an APP is a folder with all your files etc for your application add the needed files to the APP and it works.

So my fault sorry to bother everyone.

Just need to create a DMG file for distribution now.

Regards

CD

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 9:31 am
by deeproot
Here is how I do it (works for me but more expert people might have better methods?) :-

Step 1 --
Open the Disk Utility (from Utilities under Applications).
Create a New DMG Image - from the toolbar icon, giving it an appropriate size big enough to take your stuff. This is not your final file, so the size is not too critical.
Close the Disk Utility app.

(next time when you make a new version, you can skip Step 1 by making a copy instead)

Step 2 --
The empty New Disk Image will have been mounted, or if you copied one then just open it.
Use Finder to drag or copy&paste your files or folders - arranged as you wish.
Use Finder's View options to customise the appearance - hide sidebar, toolbar and so on, or colour the background. Also resize the window. It's also possible to add a background image here.
When done - Eject the Disk Image.

Step 3 --
Open the Disk Utility app again and open your new Image.
Select Convert from the toolbar, to save the Image to another DMG filename, but with the Image Format as "compressed".

That's it - you now have two files, an uncompressed one to make any further changes and compressed which is the smaller one you issue.

Hope that helps.

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 2:18 pm
by mk-soft
I like this tool to create a dmg. Link http://dmgcreator.sourceforge.net/de/

Files like pictures, sounds, etc. belong in the APP under the folder Contents/Resources. To get them into the folder I wrote IDE-Tool.
Link: http://www.purebasic.fr/english/viewtop ... 19&t=61638

here some example to get folders...

Code: Select all

;-TOP

; ---------------------------------------------------------------------------------------

Procedure.s GetAppPath()
  Protected bundlePathPtr = CocoaMessage(0,CocoaMessage(0,CocoaMessage(0,0,"NSBundle mainBundle"),"bundlePath"),"UTF8String")
  If bundlePathPtr
    Protected bundlePath.s = PeekS(bundlePathPtr,-1,#PB_UTF8) + "/"
  EndIf
  ProcedureReturn bundlePath
EndProcedure

Procedure.s GetResourceFile(Filename.s)
  Protected NSBundle, *NSPathString
  Protected file.s, ext.s, result.s
  NSBundle = CocoaMessage(0,0,"NSBundle mainBundle", 0)
  If NSBundle
    file = GetFilePart(Filename, #PB_FileSystem_NoExtension)
    ext = GetExtensionPart(Filename)
    *NSPathString = CocoaMessage(0, NSBundle, "pathForResource:$", @file, "ofType:$", @ext)
    If *NSPathString
      result = PeekS(CocoaMessage(0, *NSPathString, "UTF8String"), -1, #PB_UTF8)
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure

Procedure.s GetProgramPath()
  Protected r1.s
  r1 = GetPathPart(GetAppPath())
  ProcedureReturn r1
EndProcedure

Procedure.s GetResourcePath()
  Protected r1.s
  r1 = GetAppPath() + "Contents/Resources/"
  ProcedureReturn r1
EndProcedure

; ---------------------------------------------------------------------------------------

Debug GetAppPath()

file.s = GetAppPath() + "Contents/info.plist"
Debug "PLIST"
If ReadFile(0, file)
  While Not Eof(0)
    text.s = ReadString(0, #PB_UTF8)
    Debug text
  Wend
  CloseFile(0)
EndIf

file.s = GetResourceFile("Info.txt")
Debug "Resources -> Info.txt = " + file
If Bool(file)
  If ReadFile(0, file)
    Debug ReadString(0)
    CloseFile(0)
    Debug "Ready"
  EndIf
EndIf

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 5:26 pm
by collectordave
Brilliant

Sorted my first DMG file just doesnt open and do the copy to applications thing like others will crack that later.

Just one more silly question my app does not disply the icon on the mac it does on windows even when run from IDE?

Any ideas?

Going to try all methods.

regards

Cd

Re: Help with Install on mac

Posted: Thu Apr 19, 2018 8:50 pm
by mk-soft
Window Icon is not Mac Icons

I like this tool for Icons
Link: http://www.img2icnsapp.com

Re: Help with Install on mac

Posted: Fri Apr 20, 2018 10:44 am
by Wolfram
You can also use the OSX Preview program to save any picture as icon.
1. Open you picture with priview
2. Choose Export from the file menu
3. Click on the Format menu inside the file requester by pressing the alt kay and choose ICNS