CmisSync.Controller.CreateCmisSyncFolder C# (CSharp) Method

CreateCmisSyncFolder() public method

Create the user's CmisSync settings folder. This folder contains databases, the settings file and the log file.
public CreateCmisSyncFolder ( ) : bool
return bool
        public override bool CreateCmisSyncFolder()
        {
            if (Directory.Exists(FoldersPath))
                return false;

            Directory.CreateDirectory(FoldersPath);
            File.SetAttributes(FoldersPath, File.GetAttributes(FoldersPath) | FileAttributes.System);

            Logger.Info("Config | Created '" + FoldersPath + "'");

            string app_path = Path.GetDirectoryName(Forms.Application.ExecutablePath);
            string icon_file_path = Path.Combine(app_path, "Pixmaps", "cmissync-folder.ico");

            if (!File.Exists(icon_file_path))
            {
                icon_file_path = Assembly.GetExecutingAssembly().Location;
            }
            string ini_file_path = Path.Combine(FoldersPath, "desktop.ini");

            string ini_file = "[.ShellClassInfo]\r\n" +
                    "IconFile=" + icon_file_path + "\r\n" +
                    "IconIndex=0\r\n" +
                    "InfoTip=CmisSync\r\n" +
                    "IconResource=" + icon_file_path + ",0\r\n" +
                    "[ViewState]\r\n" +
                    "Mode=\r\n" +
                    "Vid=\r\n" +
                    "FolderType=Generic\r\n";

            try
            {
                File.WriteAllText(ini_file_path, ini_file);

                    File.SetAttributes(ini_file_path,
                        File.GetAttributes(ini_file_path) | FileAttributes.Hidden | FileAttributes.System);

            }
            catch (IOException e)
            {
                Logger.Info("Config | Failed setting icon for '" + FoldersPath + "': " + e.Message);
            }
            return true;
        }