codesfasad.blogg.se

Xojo for loop
Xojo for loop







In addition, when we use the FolderItem constructor in combination with absolute paths as arguments, we have not guarantees that the resulting reference assigned to the FolderItem variable is a valid one (in our example, pointed by the ‘f’ variable). For these cases, you can turn to the use of the conditional compilation clause #If…#Then…#Endif, providing the native path variation expected by the OS under which your app is running. It is important to point out the fact that the path format, as String, is the native one to the platform over which we are going to deploy the app, something you have to consider if you want to create a multiplatform app.

XOJO FOR LOOP CODE

With the previous line of code we will be using the FolderItem class Constructor, passing along as the argument the native path to the file we want to get the reference to, if it already exists or to the file our app expects to create. In both scenarios, the most basic way to go is the same: Dim f as new FolderItem("\users\myusuario\documents\test.txt") Of course, under iOS and other sandboxed deployments, you will have to consider the limitations imposed by the OS when dealing with files, as for example not writing to the app bundle (under OS X and iOS), accessing only the allowed folders/directories, etc.Īs it goes when using any class, the first thing you will have to do is get a new class instance (an object) pointing to the file item you want to work with, whether it is one already available or one you want to create from scratch (i.e: giving the path, name and extension). Of course, as Xojo is a native multi-platform development environment, the FolderItem class is available for all the supported deployment platforms: desktop (macOS, Windows, Linux, Raspberry Pi), console, web or iOS. The FolderItem class also gives you the methods to do a lot of file operations without effort. Xojo gives you the class FolderItem fully loaded with a useful bunch of properties that allow you to examine the attributes of any file for example, the creation or modification of dates, the file path (in several formats), if the file is an alias, etc. Sooner or later your app will need to work with files, maybe to save the data generated with the app itself, to open the files created with other apps or because is the main purpose of the utility you are working on.







Xojo for loop