Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fixed mattermost-community#269

* Fixing checkbox widht

* Fix mattermost-community#274. Add re-login button to error page.

* Fix mattermost-community#276. Login page title

* Rev Mac build version

* Update changelog for v0.6.5

* Rev Mac build number

* GitHub Actions: Build with Xcode 12.4

* Fix mattermost-community#297: Mac keybpard handling

* Rev Mac built to 12

* Update to v0.6.6

* Fix mattermost-community#312. Windows app images

* Move db and files to Documents\Focalboard on standalone Win app

* Make Win app fixupp code more robust

Co-authored-by: Jesús Espino <jespinog@gmail.com>
  • Loading branch information
chenilim and jespino authored Apr 22, 2021
1 parent e61ba4a commit 4a5d7c4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
9 changes: 7 additions & 2 deletions server/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ func main() {

// StartServer starts the server
//export StartServer
func StartServer(webPath *C.char, port int, singleUserToken, dbConfigString *C.char) {
func StartServer(webPath *C.char, filesPath *C.char, port int, singleUserToken, dbConfigString *C.char) {
startServer(
C.GoString(webPath),
C.GoString(filesPath),
port,
C.GoString(singleUserToken),
C.GoString(dbConfigString),
Expand All @@ -174,7 +175,7 @@ func StopServer() {
stopServer()
}

func startServer(webPath string, port int, singleUserToken, dbConfigString string) {
func startServer(webPath string, filesPath string, port int, singleUserToken, dbConfigString string) {
logInfo()

if pServer != nil {
Expand All @@ -189,6 +190,10 @@ func startServer(webPath string, port int, singleUserToken, dbConfigString strin
return
}

if len(filesPath) > 0 {
config.FilesPath = filesPath
}

if len(webPath) > 0 {
config.WebPath = webPath
}
Expand Down
27 changes: 21 additions & 6 deletions win-wpf/Focalboard/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,40 @@ private void InitServer() {
var appFolder = Utils.GetAppFolder();
Directory.SetCurrentDirectory(appFolder);

string tempFolder;
string appDataFolder;
try {
tempFolder = ApplicationData.Current.LocalFolder.Path;
appDataFolder = ApplicationData.Current.LocalFolder.Path;
} catch {
var documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
tempFolder = documentsFolder;
appDataFolder = Path.Combine(documentsFolder, "Focalboard");
Directory.CreateDirectory(appDataFolder);
// Not a UWP app, store in Documents

// FIXUP code: Copy from old DB location
var oldDBPath = Path.Combine(documentsFolder, "focalboard.db");
var newDBPath = Path.Combine(appDataFolder, "focalboard.db");
if (!File.Exists(newDBPath) && File.Exists(oldDBPath)) {
Debug.WriteLine($"Moving DB file from: {oldDBPath} to {newDBPath}");
File.Move(oldDBPath, newDBPath);
}
}
var dbPath = Path.Combine(tempFolder, "focalboard.db");

var dbPath = Path.Combine(appDataFolder, "focalboard.db");
Debug.WriteLine($"dbPath: {dbPath}");

var filesPath = Path.Combine(appDataFolder, "files");
Debug.WriteLine($"filesPath: {filesPath}");

var cwd = Directory.GetCurrentDirectory();
var webFolder = Path.Combine(cwd, @"pack");
webFolder = webFolder.Replace(@"\", @"/");
filesPath = filesPath.Replace(@"\", @"/");
dbPath = dbPath.Replace(@"\", @"/");
byte[] webFolderBytes = Encoding.UTF8.GetBytes(webFolder);
byte[] filesPathBytes = Encoding.UTF8.GetBytes(filesPath);
byte[] sessionTokenBytes = Encoding.UTF8.GetBytes(sessionToken);
byte[] dbPathBytes = Encoding.UTF8.GetBytes(dbPath);
GoFunctions.StartServer(webFolderBytes, port, sessionTokenBytes, dbPathBytes);
GoFunctions.StartServer(webFolderBytes, filesPathBytes, port, sessionTokenBytes, dbPathBytes);

Debug.WriteLine("Server started");
}
Expand Down Expand Up @@ -133,7 +148,7 @@ private int FindFreePort() {

static class GoFunctions {
[DllImport(@"focalboard-server.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern void StartServer(byte[] webPath, int port, byte[] singleUserToken, byte[] dbConfigString);
public static extern void StartServer(byte[] webPath, byte[] filesPath, int port, byte[] singleUserToken, byte[] dbConfigString);

[DllImport(@"focalboard-server.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern void StopServer();
Expand Down

0 comments on commit 4a5d7c4

Please sign in to comment.