1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include "scratchOps.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void OpenURL(char *url) {
// Open a browser on the given URL.
char cmd[1000] = "xdg-open ";
strcat( cmd, url);
system(cmd);
}
void SetScratchWindowTitle(char *title) {
// Set the text in the window title bar. Not yet implemented.
}
void GetFolderPathForID(int folderID, char *path, int maxPath) {
// Get the full path for a special folder:
// 1 - user's home folder
// 2 - user's desktop folder
// 3 - user's document folder
// 4 - user's photos or pictures folder (does Linux have a convention for this?)
// 5 - user's music folder (does Linux have a convention for this?)
// path is filled in with a zero-terminated string of max length maxPath
char *s = NULL;
path[0] = 0; // a zero-length path indicates failure
// get the user's HOME directory
s = getenv("HOME");
if ((s == NULL) || (strlen(s) == 0)) return;
strncat(path, s, maxPath); // home folder
if (folderID == 1) return;
if (folderID == 2) strncat(path, "/Desktop", maxPath);
if (folderID == 4) strncat(path, "/Pictures", maxPath);
if (folderID == 5) strncat(path, "/Music", maxPath);
if (folderID == 3) {
s = getenv("SUGAR_ACTIVITY_ROOT");
if (s != NULL) {
// On XO, return the writeable activity "data" directory
strncat(path, s, maxPath);
strncat(path, "/data", maxPath);
} else {
strncat(path, "/Documents", maxPath);
}
}
}
int WinShortToLongPath(char *shortPath, char* longPath, int maxPath) {
return -1; // fail on non-Windows platforms
}
int IsFileOrFolderHidden(char *fullPath) {
// Always return false on Linux
return 0;
}
void SetUnicodePasteBuffer(short int *utf16, int count) {
// Store the given Unicode UTF16 string in the paste buffer.
// No longer needed; use clipboard methods in UnicodePlugin.
}
|