Help with Install on mac

Mac OSX specific forum
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Help with Install on mac

Post 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.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Help with Install on mac

Post by Fred »

Did you append the '.app' at your filename when using 'Create Executable' ?
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Help with Install on mac

Post 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.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Help with Install on mac

Post 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
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Help with Install on mac

Post 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.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Help with Install on mac

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Help with Install on mac

Post 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
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Help with Install on mac

Post by mk-soft »

Window Icon is not Mac Icons

I like this tool for Icons
Link: http://www.img2icnsapp.com
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: Help with Install on mac

Post 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
macOS Catalina 10.15.7
Post Reply