Skip to content

Commit

Permalink
Fixes #503 better like this
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre committed Mar 16, 2021
1 parent 5cc7f62 commit 6e4c2b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MoBi.Assets/AppConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ public static string CannotLoadRelatedItemAsObjectAlreadyExistInProject(string o
return $"Cannot load related item into project. A {objectType.ToLower()} named '{objectName}' already exists.";
}

public static string FileIsReadOnly(string fileFullPath) => $"Could not save the project\nThe file '{fileFullPath}' is read-only.";
public static string FileIsReadOnly(string fileFullPath) => $"The project cannot be saved:\nThe file '{fileFullPath}' is read-only.";
}

public static class Captions
Expand Down
8 changes: 7 additions & 1 deletion src/MoBi.Presentation/Tasks/ProjectTask.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using MoBi.Assets;
using MoBi.Core.Domain.Builder;
using MoBi.Core.Domain.Model;
Expand Down Expand Up @@ -182,7 +183,12 @@ public bool Open()

public bool Save()
{
if (string.IsNullOrEmpty(_context.CurrentProject.FilePath))
var filePath = _context.CurrentProject.FilePath;
if (string.IsNullOrEmpty(filePath))
return SaveAs();

var fileInfo = new FileInfo(filePath);
if (fileInfo.Exists && fileInfo.IsReadOnly)
return SaveAs();

return saveProject();
Expand Down

0 comments on commit 6e4c2b8

Please sign in to comment.