About PureBasic

I downloaded PureBasic and here’s what I found:

a. the text (both code and help) is too small for my 'ol eye

b. it tooks me one hour to understand how to save to disk (at a visible location, especially near the project) the .sqlite file.

Creating the TABLEs was fast as an example is provided, but how do you save to desktop ? download ? elsewhere …

OK: i’m in my 70s, so I am slower than the average and habe bad vision (but with glasses).

I will check their web site to see if the Help is available as html.

BTW: alt-arrow is not implemented. and Cmd-arrow select the whole line…

The html documentation:

https://www.purebasic.com/french/documentation/index.html

small size, but it can be enlarged, thanks to the browser.

But… where are the Controls ?

I found a way to create windows, but…

Edit: apparently, the Controls are there:
https://www.purebasic.com/french/documentation/reference/ide_tools.html
Look at Form design, the screenshot shows some…

You can change the text size of the editor in the Settings under Editor->Editing->Select Font. Also, under settings->shortcuts you can assign keyboard shortcuts to Zoom In and Zoom Out. I frequently use PB on my Mac laptop where I can zoom inl/out using gestures on the trackpad.

Unfortunately, the help size cannot be changed within the editor, as far as I know. I use the documentation tool Dash to view the help and that allows me to enlarge the text size.

Does not worked. But I tried once, it was late and if it works for you…

Thanks for the tips.

Oh, you may have to enable those in the system settings on your Mac.

No (I do not think so); it works everywhere else.

BTW: I found the equivalent to SystemFolder.:

https://www.purebasic.com/french/documentation/filesystem/getuserdirectory.html

It help to be able to read the docs.

The doc font size is set to 2. Either the writer have special eyes or (s)he is 12 y/o. (or use 200% display size on windows *)

  • Most of screen shots I saw (access with a m1 MacBook Pro) were done with a Windows XP machine (not that annoy me…).

The documentalist does not know that the “Preferences” menu item have been renamed in recent macOS to Settings.

The documentation appears in French (for me, with my French macOS).

In English
https://www.purebasic.com/documentation/filesystem/getuserdirectory.html

Searching a little bit, fooling around their web site, I found the help as pdf:

or English:

(small sized text too, but pdf, so I can enlarge it !)

@Emile
Both your PDF links are French.
This is the English link:

I removed “/french“ from the testing link and forgot to copy the result !

It’s official, I am old !

NB: I stop fooling around with Pure Basic… too complex for me to have the Events in the main code.
It tooks hours to understand how things works (how to add a button, where to put the code, how to add a window, etc.)

It tooks me few hours (in 1998) to write an application _ using REALbasic 1ß.
I used anothe BASIC, but was stopped by bugs and decided to try REALbasic. So I had all Graphics and the design in my head. No code re-use.

HyperCard already had OOP (code in objects Events, not in single main code).

If you ever worked with VB6 back in the day then I would recommend giving B4J a try. It took me a little bit to figure out its B4XPages which is the equivalent to forms but once I did it mostly felt like I was working with VB6 again.

Is it running on MacOS (Apple Silicon) ?

It’s not complicated, just unfamiliar.
Here’s a simple way to attach event handlers:

Enumeration
  #Form1
  #Canvas1
EndEnumeration

; gadget event handlers ...
Procedure Canvas1_onLeftClick()
  Debug "Left Click"
EndProcedure

Procedure Canvas1_onRightClick()
  Debug "Right Click"
EndProcedure

; window layout ...
Procedure FormMain()
  If OpenWindow(#Form1, 0, 0, 420, 420, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(#Canvas1, 10, 10, 400, 400)
    
    ; bind events to callbacks ...
    BindGadgetEvent(#Canvas1, @Canvas1_onLeftClick(), #PB_EventType_LeftClick)
    BindGadgetEvent(#Canvas1, @Canvas1_onRightClick(), #PB_EventType_RightClick)
  EndIf
EndProcedure

; execution starts here ...
FormMain()
Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
1 Like

From what I can tell the IDE is only available on Windows. I see in the B4X forum that as recently as 2021 there was still a conversation asking for the IDE to be cross platform itself.

I recently acquired PureBasic, although I haven’t had a chance to get very deep into it. It was among the options I was looking at after deciding to move away from Xojo. I like that it is procedural, builds small and fast single binaries, and fairly easily integrates with C ABI libraries (dynamically or statically). It provides a reasonable set of widgets. Downsides include somewhat dated look, issues with drag/drop form builder, and lack of cross-compilation (though in theory this should be possible using Zig’s compiler or something). I had mainly been holding off because the original HTML widget was not fully implemented on the Mac. However, they made a lot of updates several months ago, to include building in a standard webview that works equally on all platforms. They are also very responsive to bugs, with numerous updates. The community is probably not that big, but pretty engaged and friendly – the forums are quite a different experience from TOF.
Overall, I plan to use it as a low-level cross-platform foundation for building scientific and engineering tools with webview-based display and probably leveraging other language runtimes for the computational work. After looking a many, many options, and combined with personally preferring procedural languages, pretty happy with going in this direction. It will take a little learning (or maybe some unlearning, to get back to the 80s and 90s in programming style), but I’m looking forward to that fun again.

2 Likes

@SteveW Do you have a simple way to make the main event loop “cleaner”? In the small apps I have made with PureBasic the number of windows and controls in that event handler loop hasn’t been too bad. I had an idea for an app that I wanted to write in PureBasic but I expect to have 20-23 windows and hundreds of controls amongst those windows. So the Select statement to handle that would be enormous.

Any tricks to somehow structure it to keep from having thousands of lines of code to scroll through?

Take a look at this I posted in another thread and don’t forget you could have each window’s code in separate file(s) and then using XIncludeFile to inject the code where you want it in your larger program.

If you’re going to use PB’s Form Designer tool you’ll probably want to uncheck the option to generate an event loop and keep the code it generates in a separate file so you can edit / regenerate your form’s layout without affecting any other code.

I do not realised…

All the code for an application in Pue Basic is stored in a single location !
(excepted if you use XIncludeFile as Steve wrote above).

I loved the way Xojo was able to “Print all the code source to pdf”, but as an utility / reference.
Placing code in Objects was very fine for my brain (to understand, even if only call to methods located in Modules).

On the other hand, I fired NetBeans yesterday, and stays with the front window asking myself what to do now. I do not found, so I Powered off the computer and went to bed watching TV and sleep…

The truth is (probably) elsewhere.

BTW: Pure Basic does nor Cross Compile ? Not a problem: develop where you want and compile / fine tune the application on the target Computer :wink:

Over time you’ll undoubtedly accumulate quite a lot of includes you’ll want to share between projects as well as code from other PureBasic forum members ( which unlike Xojo tend to be contributed free and open source ) so what I have is a folder where I store these and then include them like this:

#INCLUDES$ = "/home/steve/Projects/Purebasic/Includes/"
XIncludeFile #INCLUDES$ + "MimeTypesVT.pbi"

Below is a code snippet that uses a Structure, Interface and VTable to create an object. Although it’s a long snippet most of it is just adding mime types to a hash map, the code you need to digest to grasp the concept of creating an object in PureBasic is < 70 lines:

EnableExplicit

Structure MimeTypesStructure
  vtable.i
  mtmutex.i
  Map mimetypes.s()
EndStructure

Interface MimeTypesInterface
  Add(ext$, val$)
  Free()
  Get.s(ext$)
EndInterface

Procedure _mime_types_add(*this.MimeTypesStructure, ext$, val$)
  LockMutex(*this\mtmutex)
  If FindMapElement(*this\mimetypes(), ext$)
    ; already defined ...
  Else
    AddMapElement(*this\mimetypes(), ext$)
    *this\mimetypes() = val$
  EndIf
  UnlockMutex(*this\mtmutex)
EndProcedure

Procedure _mime_types_free(*this.MimeTypesStructure)
  LockMutex(*this\mtmutex)
  ClearMap(*this\mimetypes())
  UnlockMutex(*this\mtmutex)
  FreeStructure(*this)
EndProcedure

Procedure.s _mime_types_get(*this.MimeTypesStructure, ext$)
  Define.s findval = LCase(ReplaceString(ext$, ".", ""))
  Define.s returnval = "application/octet-stream"
  LockMutex(*this\mtmutex)
  If FindMapElement(*this\mimetypes(), findval)
    returnval = *this\mimetypes()
  EndIf
  UnlockMutex(*this\mtmutex)
  ProcedureReturn returnval
EndProcedure

Procedure MimeTypes_New()
	Protected *this.MimeTypesStructure = AllocateStructure(MimeTypesStructure)
	If *this = 0
		ProcedureReturn #False
	EndIf
	*this\vtable = ?_VT_MIMETYPES_
	*this\mtmutex = CreateMutex()
	
  _mime_types_add(*this, "3dm", "x-world/x-3dmf")
  _mime_types_add(*this, "3dmf", "x-world/x-3dmf")
  _mime_types_add(*this, "7z", "application/x-7z-compressed")
  _mime_types_add(*this, "a", "application/octet-stream")
  _mime_types_add(*this, "aab", "application/x-authorware-bin")
  _mime_types_add(*this, "aam", "application/x-authorware-map")
  _mime_types_add(*this, "aas", "application/x-authorware-seg")
  _mime_types_add(*this, "abc", "text/vndabc")
  _mime_types_add(*this, "acgi", "text/html")
  _mime_types_add(*this, "afl", "video/animaflex")
  _mime_types_add(*this, "ai", "application/postscript")
  _mime_types_add(*this, "aif", "audio/aiff")
  _mime_types_add(*this, "aifc", "audio/aiff")
  _mime_types_add(*this, "aiff", "audio/aiff")
  _mime_types_add(*this, "aim", "application/x-aim")
  _mime_types_add(*this, "aip", "text/x-audiosoft-intra")
  _mime_types_add(*this, "ani", "application/x-navi-animation")
  _mime_types_add(*this, "aos", "application/x-nokia-9000-communicator-add-on-software")
  _mime_types_add(*this, "aps", "application/mime")
  _mime_types_add(*this, "arc", "application/octet-stream")
  _mime_types_add(*this, "arj", "application/arj")
  _mime_types_add(*this, "art", "image/x-jg")
  _mime_types_add(*this, "asf", "video/x-ms-asf")
  _mime_types_add(*this, "asm", "text/x-asm")
  _mime_types_add(*this, "asp", "text/asp")
  _mime_types_add(*this, "asx", "application/x-mplayer2")
  _mime_types_add(*this, "au", "audio/basic")
  _mime_types_add(*this, "avi", "application/x-troff-msvideo")
  _mime_types_add(*this, "avs", "video/avs-video")
  _mime_types_add(*this, "bcpio", "application/x-bcpio")
  _mime_types_add(*this, "bin", "application/mac-binary")
  _mime_types_add(*this, "bm", "image/bmp")
  _mime_types_add(*this, "bmp", "image/bmp")
  _mime_types_add(*this, "boo", "application/book")
  _mime_types_add(*this, "book", "application/book")
  _mime_types_add(*this, "boz", "application/x-bzip2")
  _mime_types_add(*this, "bsh", "application/x-bsh")
  _mime_types_add(*this, "bz", "application/x-bzip")
  _mime_types_add(*this, "bz2", "application/x-bzip2")
  _mime_types_add(*this, "c", "text/plain")
  _mime_types_add(*this, "c++", "text/plain")
  _mime_types_add(*this, "cat", "application/vndms-pkiseccat")
  _mime_types_add(*this, "cc", "text/plain")
  _mime_types_add(*this, "ccad", "application/clariscad")
  _mime_types_add(*this, "cco", "application/x-cocoa")
  _mime_types_add(*this, "cdf", "application/cdf")
  _mime_types_add(*this, "cer", "application/pkix-cert")
  _mime_types_add(*this, "cha", "application/x-chat")
  _mime_types_add(*this, "chat", "application/x-chat")
  _mime_types_add(*this, "class", "application/java")
  _mime_types_add(*this, "com", "application/octet-stream")
  _mime_types_add(*this, "conf", "text/plain")
  _mime_types_add(*this, "cpio", "application/x-cpio")
  _mime_types_add(*this, "cpp", "text/plain")
  _mime_types_add(*this, "cpt", "application/mac-compactpro")
  _mime_types_add(*this, "crl", "application/pkcs-crl")
  _mime_types_add(*this, "crt", "application/pkix-cert")
  _mime_types_add(*this, "csh", "application/x-csh")
  _mime_types_add(*this, "css", "text/css")
  _mime_types_add(*this, "csv", "text/csv")
  _mime_types_add(*this, "cxx", "text/plain")
  _mime_types_add(*this, "dcr", "application/x-director")
  _mime_types_add(*this, "deepv", "application/x-deepv")
  _mime_types_add(*this, "def", "text/plain")
  _mime_types_add(*this, "der", "application/x-x509-ca-cert")
  _mime_types_add(*this, "dif", "video/x-dv")
  _mime_types_add(*this, "dir", "application/x-director")
  _mime_types_add(*this, "dl", "video/dl")
  _mime_types_add(*this, "doc", "application/msword")
  _mime_types_add(*this, "docx", "application/vndopenxmlformats-officedocumentwordprocessingmldocument")
  _mime_types_add(*this, "dot", "application/msword")
  _mime_types_add(*this, "dp", "application/commonground")
  _mime_types_add(*this, "drw", "application/drafting")
  _mime_types_add(*this, "dump", "application/octet-stream")
  _mime_types_add(*this, "dv", "video/x-dv")
  _mime_types_add(*this, "dvi", "application/x-dvi")
  _mime_types_add(*this, "dwf", "drawing/x-dwf(old)")
  _mime_types_add(*this, "dwg", "application/acad")
  _mime_types_add(*this, "dxf", "application/dxf")
  _mime_types_add(*this, "dxr", "application/x-director")
  _mime_types_add(*this, "el", "text/x-scriptelisp")
  _mime_types_add(*this, "elc", "application/x-bytecodeelisp(compiledelisp)")
  _mime_types_add(*this, "env", "application/x-envoy")
  _mime_types_add(*this, "eot", "application/vndms-fontobject")
  _mime_types_add(*this, "eps", "application/postscript")
  _mime_types_add(*this, "es", "application/x-esrehber")
  _mime_types_add(*this, "etx", "text/x-setext")
  _mime_types_add(*this, "evy", "application/envoy")
  _mime_types_add(*this, "exe", "application/octet-stream")
  _mime_types_add(*this, "f", "text/plain")
  _mime_types_add(*this, "f77", "text/x-fortran")
  _mime_types_add(*this, "f90", "text/plain")
  _mime_types_add(*this, "fdf", "application/vndfdf")
  _mime_types_add(*this, "fif", "application/fractals")
  _mime_types_add(*this, "flac", "audio/flac")
  _mime_types_add(*this, "fli", "video/fli")
  _mime_types_add(*this, "flo", "image/florian")
  _mime_types_add(*this, "flx", "text/vndfmiflexstor")
  _mime_types_add(*this, "fmf", "video/x-atomic3d-feature")
  _mime_types_add(*this, "for", "text/plain")
  _mime_types_add(*this, "fpx", "image/vndfpx")
  _mime_types_add(*this, "frl", "application/freeloader")
  _mime_types_add(*this, "funk", "audio/make")
  _mime_types_add(*this, "g", "text/plain")
  _mime_types_add(*this, "g3", "image/g3fax")
  _mime_types_add(*this, "gif", "image/gif")
  _mime_types_add(*this, "gl", "video/gl")
  _mime_types_add(*this, "gsd", "audio/x-gsm")
  _mime_types_add(*this, "gsm", "audio/x-gsm")
  _mime_types_add(*this, "gsp", "application/x-gsp")
  _mime_types_add(*this, "gss", "application/x-gss")
  _mime_types_add(*this, "gtar", "application/x-gtar")
  _mime_types_add(*this, "gz", "application/x-compressed")
  _mime_types_add(*this, "gzip", "application/x-gzip")
  _mime_types_add(*this, "h", "text/plain")
  _mime_types_add(*this, "hdf", "application/x-hdf")
  _mime_types_add(*this, "help", "application/x-helpfile")
  _mime_types_add(*this, "hgl", "application/vndhp-hpgl")
  _mime_types_add(*this, "hh", "text/plain")
  _mime_types_add(*this, "hlb", "text/x-script")
  _mime_types_add(*this, "hlp", "application/hlp")
  _mime_types_add(*this, "hpg", "application/vndhp-hpgl")
  _mime_types_add(*this, "hpgl", "application/vndhp-hpgl")
  _mime_types_add(*this, "hqx", "application/binhex")
  _mime_types_add(*this, "hta", "application/hta")
  _mime_types_add(*this, "htc", "text/x-component")
  _mime_types_add(*this, "htm", "text/html")
  _mime_types_add(*this, "html", "text/html")
  _mime_types_add(*this, "htmls", "text/html")
  _mime_types_add(*this, "htt", "text/webviewhtml")
  _mime_types_add(*this, "htx", "text/html")
  _mime_types_add(*this, "ice", "x-conference/x-cooltalk")
  _mime_types_add(*this, "ico", "image/x-icon")
  _mime_types_add(*this, "ics", "text/calendar")
  _mime_types_add(*this, "idc", "text/plain")
  _mime_types_add(*this, "ief", "image/ief")
  _mime_types_add(*this, "iefs", "image/ief")
  _mime_types_add(*this, "iges", "application/iges")
  _mime_types_add(*this, "igs", "application/iges")
  _mime_types_add(*this, "ima", "application/x-ima")
  _mime_types_add(*this, "imap", "application/x-httpd-imap")
  _mime_types_add(*this, "inf", "application/inf")
  _mime_types_add(*this, "ins", "application/x-internett-signup")
  _mime_types_add(*this, "ip", "application/x-ip2")
  _mime_types_add(*this, "isu", "video/x-isvideo")
  _mime_types_add(*this, "it", "audio/it")
  _mime_types_add(*this, "iv", "application/x-inventor")
  _mime_types_add(*this, "ivr", "i-world/i-vrml")
  _mime_types_add(*this, "ivy", "application/x-livescreen")
  _mime_types_add(*this, "jam", "audio/x-jam")
  _mime_types_add(*this, "jav", "text/plain")
  _mime_types_add(*this, "java", "text/plain")
  _mime_types_add(*this, "jcm", "application/x-java-commerce")
  _mime_types_add(*this, "jfif", "image/jpeg")
  _mime_types_add(*this, "jfif-tbnl", "image/jpeg")
  _mime_types_add(*this, "jpe", "image/jpeg")
  _mime_types_add(*this, "jpeg", "image/jpeg")
  _mime_types_add(*this, "jpg", "image/jpeg")
  _mime_types_add(*this, "jps", "image/x-jps")
  _mime_types_add(*this, "js", "application/x-javascript")
  _mime_types_add(*this, "json", "application/json")
  _mime_types_add(*this, "jut", "image/jutvision")
  _mime_types_add(*this, "kar", "audio/midi")
  _mime_types_add(*this, "ksh", "application/x-ksh")
  _mime_types_add(*this, "la", "audio/nspaudio")
  _mime_types_add(*this, "lam", "audio/x-liveaudio")
  _mime_types_add(*this, "latex", "application/x-latex")
  _mime_types_add(*this, "lha", "application/lha")
  _mime_types_add(*this, "lhx", "application/octet-stream")
  _mime_types_add(*this, "list", "text/plain")
  _mime_types_add(*this, "lma", "audio/nspaudio")
  _mime_types_add(*this, "log", "text/plain")
  _mime_types_add(*this, "lsp", "application/x-lisp")
  _mime_types_add(*this, "lst", "text/plain")
  _mime_types_add(*this, "lsx", "text/x-la-asf")
  _mime_types_add(*this, "ltx", "application/x-latex")
  _mime_types_add(*this, "lzh", "application/octet-stream")
  _mime_types_add(*this, "lzx", "application/lzx")
  _mime_types_add(*this, "m", "text/plain")
  _mime_types_add(*this, "m1v", "video/mpeg")
  _mime_types_add(*this, "m2a", "audio/mpeg")
  _mime_types_add(*this, "m2v", "video/mpeg")
  _mime_types_add(*this, "m3u", "audio/x-mpequrl")
  _mime_types_add(*this, "man", "application/x-troff-man")
  _mime_types_add(*this, "map", "application/x-navimap")
  _mime_types_add(*this, "mar", "text/plain")
  _mime_types_add(*this, "mbd", "application/mbedlet")
  _mime_types_add(*this, "mc$", "application/x-magic-cap-package-10")
  _mime_types_add(*this, "mcd", "application/mcad")
  _mime_types_add(*this, "mcf", "image/vasa")
  _mime_types_add(*this, "mcp", "application/netmc")
  _mime_types_add(*this, "me", "application/x-troff-me")
  _mime_types_add(*this, "mht", "message/rfc822")
  _mime_types_add(*this, "mhtml", "message/rfc822")
  _mime_types_add(*this, "mid", "application/x-midi")
  _mime_types_add(*this, "midi", "application/x-midi")
  _mime_types_add(*this, "mif", "application/x-frame")
  _mime_types_add(*this, "mime", "message/rfc822")
  _mime_types_add(*this, "mjf", "audio/x-vndaudioexplosionmjuicemediafile")
  _mime_types_add(*this, "mjpg", "video/x-motion-jpeg")
  _mime_types_add(*this, "mka", "audio/x-matroska")
  _mime_types_add(*this, "mkv", "video/x-matroska")
  _mime_types_add(*this, "mm", "application/base64")
  _mime_types_add(*this, "mme", "application/base64")
  _mime_types_add(*this, "mod", "audio/mod")
  _mime_types_add(*this, "moov", "video/quicktime")
  _mime_types_add(*this, "mov", "video/quicktime")
  _mime_types_add(*this, "movie", "video/x-sgi-movie")
  _mime_types_add(*this, "mp2", "audio/mpeg")
  _mime_types_add(*this, "mp3", "audio/mpeg3")
  _mime_types_add(*this, "mp4", "video/mp4")
  _mime_types_add(*this, "mpa", "audio/mpeg")
  _mime_types_add(*this, "mpc", "application/x-project")
  _mime_types_add(*this, "mpe", "video/mpeg")
  _mime_types_add(*this, "mpeg", "video/mpeg")
  _mime_types_add(*this, "mpg", "audio/mpeg")
  _mime_types_add(*this, "mpga", "audio/mpeg")
  _mime_types_add(*this, "mpp", "application/vndms-project")
  _mime_types_add(*this, "mpt", "application/x-project")
  _mime_types_add(*this, "mpv", "application/x-project")
  _mime_types_add(*this, "mpx", "application/x-project")
  _mime_types_add(*this, "mrc", "application/marc")
  _mime_types_add(*this, "ms", "application/x-troff-ms")
  _mime_types_add(*this, "mv", "video/x-sgi-movie")
  _mime_types_add(*this, "my", "audio/make")
  _mime_types_add(*this, "mzz", "application/x-vndaudioexplosionmzz")
  _mime_types_add(*this, "nap", "image/naplps")
  _mime_types_add(*this, "naplps", "image/naplps")
  _mime_types_add(*this, "nc", "application/x-netcdf")
  _mime_types_add(*this, "ncm", "application/vndnokiaconfiguration-message")
  _mime_types_add(*this, "nif", "image/x-niff")
  _mime_types_add(*this, "niff", "image/x-niff")
  _mime_types_add(*this, "nix", "application/x-mix-transfer")
  _mime_types_add(*this, "nsc", "application/x-conference")
  _mime_types_add(*this, "nvd", "application/x-navidoc")
  _mime_types_add(*this, "o", "application/octet-stream")
  _mime_types_add(*this, "oda", "application/oda")
  _mime_types_add(*this, "odt", "application/vnd.oasis.opendocument.text")
  _mime_types_add(*this, "ogg", "audio/ogg")
  _mime_types_add(*this, "omc", "application/x-omc")
  _mime_types_add(*this, "omcd", "application/x-omcdatamaker")
  _mime_types_add(*this, "omcr", "application/x-omcregerator")
  _mime_types_add(*this, "otf", "font/otf")
  _mime_types_add(*this, "p", "text/x-pascal")
  _mime_types_add(*this, "p10", "application/pkcs10")
  _mime_types_add(*this, "p12", "application/pkcs-12")
  _mime_types_add(*this, "p7a", "application/x-pkcs7-signature")
  _mime_types_add(*this, "p7c", "application/pkcs7-mime")
  _mime_types_add(*this, "p7m", "application/pkcs7-mime")
  _mime_types_add(*this, "p7r", "application/x-pkcs7-certreqresp")
  _mime_types_add(*this, "p7s", "application/pkcs7-signature")
  _mime_types_add(*this, "part", "application/pro_eng")
  _mime_types_add(*this, "pas", "text/pascal")
  _mime_types_add(*this, "pbm", "image/x-portable-bitmap")
  _mime_types_add(*this, "pcl", "application/vndhp-pcl")
  _mime_types_add(*this, "pct", "image/x-pict")
  _mime_types_add(*this, "pcx", "image/x-pcx")
  _mime_types_add(*this, "pdb", "chemical/x-pdb")
  _mime_types_add(*this, "pdf", "application/pdf")
  _mime_types_add(*this, "pfunk", "audio/make")
  _mime_types_add(*this, "pgm", "image/x-portable-graymap")
  _mime_types_add(*this, "pgm", "application/x-httpd-php")
  _mime_types_add(*this, "pic", "image/pict")
  _mime_types_add(*this, "pict", "image/pict")
  _mime_types_add(*this, "pkg", "application/x-newton-compatible-pkg")
  _mime_types_add(*this, "pko", "application/vndms-pkipko")
  _mime_types_add(*this, "pl", "text/plain")
  _mime_types_add(*this, "plx", "application/x-pixclscript")
  _mime_types_add(*this, "pm", "image/x-xpixmap")
  _mime_types_add(*this, "pm4", "application/x-pagemaker")
  _mime_types_add(*this, "pm5", "application/x-pagemaker")
  _mime_types_add(*this, "png", "image/png")
  _mime_types_add(*this, "pnm", "application/x-portable-anymap")
  _mime_types_add(*this, "pot", "application/mspowerpoint")
  _mime_types_add(*this, "pov", "model/x-pov")
  _mime_types_add(*this, "ppa", "application/vndms-powerpoint")
  _mime_types_add(*this, "ppm", "image/x-portable-pixmap")
  _mime_types_add(*this, "pps", "application/mspowerpoint")
  _mime_types_add(*this, "ppt", "application/mspowerpoint")
  _mime_types_add(*this, "pptx", "application/vndopenxmlformats-officedocumentpresentationmlpresentation")
  _mime_types_add(*this, "ppz", "application/mspowerpoint")
  _mime_types_add(*this, "pre", "application/x-freelance")
  _mime_types_add(*this, "prt", "application/pro_eng")
  _mime_types_add(*this, "ps", "application/postscript")
  _mime_types_add(*this, "psd", "application/octet-stream")
  _mime_types_add(*this, "pvu", "paleovu/x-pv")
  _mime_types_add(*this, "pwz", "application/vndms-powerpoint")
  _mime_types_add(*this, "py", "text/x-scriptphyton")
  _mime_types_add(*this, "pyc", "application/x-bytecodepython")
  _mime_types_add(*this, "qcp", "audio/vndqcelp")
  _mime_types_add(*this, "qd3", "x-world/x-3dmf")
  _mime_types_add(*this, "qd3d", "x-world/x-3dmf")
  _mime_types_add(*this, "qif", "image/x-quicktime")
  _mime_types_add(*this, "qt", "video/quicktime")
  _mime_types_add(*this, "qtc", "video/x-qtc")
  _mime_types_add(*this, "qti", "image/x-quicktime")
  _mime_types_add(*this, "qtif", "image/x-quicktime")
  _mime_types_add(*this, "ra", "audio/x-pn-realaudio")
  _mime_types_add(*this, "ram", "audio/x-pn-realaudio")
  _mime_types_add(*this, "ras", "application/x-cmu-raster")
  _mime_types_add(*this, "rast", "image/cmu-raster")
  _mime_types_add(*this, "rar", "application/vndrar")
  _mime_types_add(*this, "rexx", "text/x-scriptrexx")
  _mime_types_add(*this, "rf", "image/vndrn-realflash")
  _mime_types_add(*this, "rgb", "image/x-rgb")
  _mime_types_add(*this, "rm", "application/vndrn-realmedia")
  _mime_types_add(*this, "rmi", "audio/mid")
  _mime_types_add(*this, "rmm", "audio/x-pn-realaudio")
  _mime_types_add(*this, "rmp", "audio/x-pn-realaudio")
  _mime_types_add(*this, "rng", "application/ringing-tones")
  _mime_types_add(*this, "rnx", "application/vndrn-realplayer")
  _mime_types_add(*this, "roff", "application/x-troff")
  _mime_types_add(*this, "rp", "image/vndrn-realpix")
  _mime_types_add(*this, "rpm", "audio/x-pn-realaudio-plugin")
  _mime_types_add(*this, "rt", "text/richtext")
  _mime_types_add(*this, "rtf", "application/rtf")
  _mime_types_add(*this, "rtx", "application/rtf")
  _mime_types_add(*this, "rv", "video/vndrn-realvideo")
  _mime_types_add(*this, "s", "text/x-asm")
  _mime_types_add(*this, "s3m", "audio/s3m")
  _mime_types_add(*this, "saveme", "application/octet-stream")
  _mime_types_add(*this, "sbk", "application/x-tbook")
  _mime_types_add(*this, "scm", "application/x-lotusscreencam")
  _mime_types_add(*this, "sdml", "text/plain")
  _mime_types_add(*this, "sdp", "application/sdp")
  _mime_types_add(*this, "sdr", "application/sounder")
  _mime_types_add(*this, "sea", "application/sea")
  _mime_types_add(*this, "set", "application/set")
  _mime_types_add(*this, "sgm", "text/sgml")
  _mime_types_add(*this, "sgml", "text/sgml")
  _mime_types_add(*this, "sh", "application/x-bsh")
  _mime_types_add(*this, "shar", "application/x-bsh")
  _mime_types_add(*this, "shtml", "text/html")
  _mime_types_add(*this, "sid", "audio/x-psid")
  _mime_types_add(*this, "sit", "application/x-sit")
  _mime_types_add(*this, "skd", "application/x-koan")
  _mime_types_add(*this, "skm", "application/x-koan")
  _mime_types_add(*this, "skp", "application/x-koan")
  _mime_types_add(*this, "skt", "application/x-koan")
  _mime_types_add(*this, "sl", "application/x-seelogo")
  _mime_types_add(*this, "smi", "application/smil")
  _mime_types_add(*this, "smil", "application/smil")
  _mime_types_add(*this, "snd", "audio/basic")
  _mime_types_add(*this, "sol", "application/solids")
  _mime_types_add(*this, "spc", "application/x-pkcs7-certificates")
  _mime_types_add(*this, "spl", "application/futuresplash")
  _mime_types_add(*this, "spr", "application/x-sprite")
  _mime_types_add(*this, "sprite", "application/x-sprite")
  _mime_types_add(*this, "src", "application/x-wais-source")
  _mime_types_add(*this, "ssi", "text/x-server-parsed-html")
  _mime_types_add(*this, "ssm", "application/streamingmedia")
  _mime_types_add(*this, "sst", "application/vndms-pkicertstore")
  _mime_types_add(*this, "step", "application/step")
  _mime_types_add(*this, "stl", "application/sla")
  _mime_types_add(*this, "stp", "application/step")
  _mime_types_add(*this, "sv4cpio", "application/x-sv4cpio")
  _mime_types_add(*this, "sv4crc", "application/x-sv4crc")
  _mime_types_add(*this, "svf", "image/vnddwg")
  _mime_types_add(*this, "svg", "image/svg+xml")
  _mime_types_add(*this, "svr", "application/x-world")
  _mime_types_add(*this, "swf", "application/x-shockwave-flash")
  _mime_types_add(*this, "t", "application/x-troff")
  _mime_types_add(*this, "talk", "text/x-speech")
  _mime_types_add(*this, "tar", "application/x-tar")
  _mime_types_add(*this, "tbk", "application/toolbook")
  _mime_types_add(*this, "tcl", "application/x-tcl")
  _mime_types_add(*this, "tcsh", "text/x-scripttcsh")
  _mime_types_add(*this, "tex", "application/x-tex")
  _mime_types_add(*this, "texi", "application/x-texinfo")
  _mime_types_add(*this, "texinfo", "application/x-texinfo")
  _mime_types_add(*this, "text", "application/plain")
  _mime_types_add(*this, "tgz", "application/gnutar")
  _mime_types_add(*this, "tif", "image/tiff")
  _mime_types_add(*this, "tiff", "image/tiff")
  _mime_types_add(*this, "tr", "application/x-troff")
  _mime_types_add(*this, "ts", "video/mp2t")
  _mime_types_add(*this, "tsi", "audio/tsp-audio")
  _mime_types_add(*this, "tsp", "application/dsptype")
  _mime_types_add(*this, "tsv", "text/tab-separated-values")
  _mime_types_add(*this, "turbot", "image/florian")
  _mime_types_add(*this, "txt", "text/plain")
  _mime_types_add(*this, "uil", "text/x-uil")
  _mime_types_add(*this, "uni", "text/uri-list")
  _mime_types_add(*this, "unis", "text/uri-list")
  _mime_types_add(*this, "unv", "application/i-deas")
  _mime_types_add(*this, "uri", "text/uri-list")
  _mime_types_add(*this, "uris", "text/uri-list")
  _mime_types_add(*this, "ustar", "application/x-ustar")
  _mime_types_add(*this, "uu", "application/octet-stream")
  _mime_types_add(*this, "uue", "text/x-uuencode")
  _mime_types_add(*this, "vcd", "application/x-cdlink")
  _mime_types_add(*this, "vcs", "text/x-vcalendar")
  _mime_types_add(*this, "vda", "application/vda")
  _mime_types_add(*this, "vdo", "video/vdo")
  _mime_types_add(*this, "vew", "application/groupwise")
  _mime_types_add(*this, "viv", "video/vivo")
  _mime_types_add(*this, "vivo", "video/vivo")
  _mime_types_add(*this, "vmd", "application/vocaltec-media-desc")
  _mime_types_add(*this, "vmf", "application/vocaltec-media-file")
  _mime_types_add(*this, "voc", "audio/voc")
  _mime_types_add(*this, "vos", "video/vosaic")
  _mime_types_add(*this, "vox", "audio/voxware")
  _mime_types_add(*this, "vqe", "audio/x-twinvq-plugin")
  _mime_types_add(*this, "vqf", "audio/x-twinvq")
  _mime_types_add(*this, "vql", "audio/x-twinvq-plugin")
  _mime_types_add(*this, "vrml", "application/x-vrml")
  _mime_types_add(*this, "vrt", "x-world/x-vrt")
  _mime_types_add(*this, "vsd", "application/x-visio")
  _mime_types_add(*this, "vst", "application/x-visio")
  _mime_types_add(*this, "vsw", "application/x-visio")
  _mime_types_add(*this, "w60", "application/wordperfect60")
  _mime_types_add(*this, "w61", "application/wordperfect61")
  _mime_types_add(*this, "w6w", "application/msword")
  _mime_types_add(*this, "wav", "audio/wav")
  _mime_types_add(*this, "wb1", "application/x-qpro")
  _mime_types_add(*this, "wbmp", "image/vndwapwbmp")
  _mime_types_add(*this, "web", "application/vndxara")
  _mime_types_add(*this, "webm", "video/webm")
  _mime_types_add(*this, "webp", "image/webp")
  _mime_types_add(*this, "wiz", "application/msword")
  _mime_types_add(*this, "wk1", "application/x-123")
  _mime_types_add(*this, "wmf", "windows/metafile")
  _mime_types_add(*this, "wml", "text/vndwapwml")
  _mime_types_add(*this, "wmlc", "application/vndwapwmlc")
  _mime_types_add(*this, "wmls", "text/vndwapwmlscript")
  _mime_types_add(*this, "wmlsc", "application/vndwapwmlscriptc")
  _mime_types_add(*this, "word", "application/msword")
  _mime_types_add(*this, "woff", "font/woff")
  _mime_types_add(*this, "woff2", "font/woff2")
  _mime_types_add(*this, "wp", "application/wordperfect")
  _mime_types_add(*this, "wp5", "application/wordperfect")
  _mime_types_add(*this, "wp6", "application/wordperfect")
  _mime_types_add(*this, "wpd", "application/wordperfect")
  _mime_types_add(*this, "wq1", "application/x-lotus")
  _mime_types_add(*this, "wri", "application/mswrite")
  _mime_types_add(*this, "wrl", "application/x-world")
  _mime_types_add(*this, "wrz", "model/vrml")
  _mime_types_add(*this, "wsc", "text/scriplet")
  _mime_types_add(*this, "wsrc", "application/x-wais-source")
  _mime_types_add(*this, "wtk", "application/x-wintalk")
  _mime_types_add(*this, "xbm", "image/x-xbitmap")
  _mime_types_add(*this, "xdr", "video/x-amt-demorun")
  _mime_types_add(*this, "xgz", "xgl/drawing")
  _mime_types_add(*this, "xif", "image/vndxiff")
  _mime_types_add(*this, "xl", "application/excel")
  _mime_types_add(*this, "xla", "application/excel")
  _mime_types_add(*this, "xlb", "application/excel")
  _mime_types_add(*this, "xlc", "application/excel")
  _mime_types_add(*this, "xld", "application/excel")
  _mime_types_add(*this, "xlk", "application/excel")
  _mime_types_add(*this, "xll", "application/excel")
  _mime_types_add(*this, "xlm", "application/excel")
  _mime_types_add(*this, "xls", "application/excel")
  _mime_types_add(*this, "xlt", "application/excel")
  _mime_types_add(*this, "xlv", "application/excel")
  _mime_types_add(*this, "xlw", "application/excel")
  _mime_types_add(*this, "xm", "audio/xm")
  _mime_types_add(*this, "xml", "application/xml")
  _mime_types_add(*this, "xmz", "xgl/movie")
  _mime_types_add(*this, "xpix", "application/x-vndls-xpix")
  _mime_types_add(*this, "xpm", "image/x-xpixmap")
  _mime_types_add(*this, "x-png", "image/png")
  _mime_types_add(*this, "xlsx", "application/vndopenxmlformats-officedocumentspreadsheetmlsheet")
  _mime_types_add(*this, "xsr", "video/x-amt-showrun")
  _mime_types_add(*this, "xwd", "image/x-xwd")
  _mime_types_add(*this, "xyz", "chemical/x-pdb")
  _mime_types_add(*this, "yaml", "application/x-yaml")
  _mime_types_add(*this, "yml", "application/x-yaml")
  _mime_types_add(*this, "z", "application/x-compress")
  _mime_types_add(*this, "zip", "application/x-compressed")
  _mime_types_add(*this, "zoo", "application/octet-stream")
  _mime_types_add(*this, "zsh", "text/x-scriptzsh")
	
	ProcedureReturn *this
  
	DataSection
		_VT_MIMETYPES_:
		Data.i @_mime_types_add()
		Data.i @_mime_types_free()
		Data.i @_mime_types_get()
	EndDataSection
EndProcedure

CompilerIf #PB_Compiler_IsMainFile
	
	Define mt.MimeTypesInterface
	
	mt = MimeTypes_New()
	ExamineDirectory(0, GetUserDirectory(#PB_Directory_Documents), "*.*")
	While NextDirectoryEntry(0)
	  Debug DirectoryEntryName(0) + ": " + mt\Get(GetExtensionPart(DirectoryEntryName(0)))
	Wend
	mt\Free()
	
CompilerEndIf
1 Like

Right, not a big issue, especially since the lifetime license covers all platforms. With Xojo, I pretty much had to build on each OS separately anyway to tune, so this wasn’t a dealbreaker.

1 Like