Commit Graph

295 Commits

Author SHA1 Message Date
wmayer
c3b38bda08 App: [skip ci] fix warnings reported by GH actions 2022-11-17 23:50:34 +01:00
wmayer
e10b23ca70 App: replace boolean with enum 2022-11-17 17:38:31 +01:00
wmayer
ea5a5ff363 App: [skip ci] for the dependency graph use orange color to indicate links that go out of scope 2022-10-08 16:29:36 +02:00
wmayer
5240a30431 App: modernize C++: replace 'typedef' with 'using' 2022-08-29 12:58:39 +02:00
wmayer
cf399afe87 App: minor improvements:
* use 'using' instead of 'typedef' [modernize-use-using]
* fix bugprone-reserved-identifier
* fix whitespace/comma
2022-08-28 16:15:57 +02:00
wmayer
e809295342 App: replace some while loops with range-based for loops to increase readability 2022-08-28 15:42:57 +02:00
berniev
2a2062ec46 App: use auto - strange iterator (PR #7405) 2022-08-28 15:29:52 +02:00
berniev
d66df602ad App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
wmayer
71015d23d0 App: fix possible dangling pointer in Document::removeObject() 2022-08-22 11:15:14 +02:00
berniev
1cc6329eab App: use empty 2022-08-06 19:29:59 +02:00
berniev
e7357c1a99 App: use emplace_back 2022-08-05 10:31:51 +02:00
berniev
65a356835b App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
Uwe
47c2e77ebf [App] [skip CI] Document: some .clang style fixes
- for better readability
2022-07-31 17:14:43 +02:00
berniev
4028a1dda5 App: Use https 2022-07-31 17:11:14 +02:00
berniev
b40de7a509 remove redundant void 2022-07-31 10:27:44 +02:00
wmayer
84eb5fe9e2 App: fixes #7277: Write to network drive fails on Windows 2022-07-30 12:11:14 +02:00
andrea
0c4c3cc786 Remove unused code into App 2022-07-23 14:27:50 +02:00
wmayer
d7d503de8d App: fix build failure on Windows caused by PR #7034 2022-07-04 00:54:49 +02:00
flachyjoe
738f6f47e9 [App] Fix file not found error with canonical filename
boost::filesystem::canonical doesn't resolve non existent file where
boost::filesystem::weakly_canonical does.

Notice boost::filesystem::weakly_canonical only resolve absolute path.
2022-07-04 00:50:43 +02:00
flachyjoe
84d766f0eb [App] Fix #5592 : Respect symbolic links
Use the real path to the file when saving the document.
2022-07-04 00:50:43 +02:00
Uwe
063fd56f5f [App] remove unnecessary Boolean comparisons 2022-06-19 15:18:34 +02:00
wmayer
a9d0d71b06 App: implement DocumentP::clearDocument() to reduce code duplication 2022-05-08 21:32:34 +02:00
wmayer
c960622b3d App: fixes #6840: Crash in ObjectIdentifier::resolveProperty 2022-05-06 20:34:08 +02:00
Chris Hennes
132a1d7e55 App: PR6497 move return statement to new line 2022-03-29 12:33:37 -05:00
Adrian
a7ef1d7aa8 fix creation of backup file even when numberOfFiles<=0 in applyTimeStamp
and move file deletion inside if (fi.exists()) block
2022-03-28 19:17:43 +02:00
Adrian
c346f76ae8 move tmp file rename after file deletion in applyTimeStamp when numberOfFiles <=0 [fixes #6532] 2022-03-28 19:17:43 +02:00
wmayer
749361d2f3 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
wmayer
b84e41bc89 App: make sure to create parent directories of a document's transient directory 2022-03-19 13:58:10 +01:00
wmayer
4977e55e51 App: Optimize includes to reduce compile time 2022-03-07 15:53:58 +01:00
wmayer
58a719e207 Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
wmayer
4d9ddcfa66 App: move member DocumentPythonObject to DocumentP 2022-03-03 20:28:47 +01:00
wmayer
7f8940b858 App: [skip ci] Add enum value to suppress error messages on document recompute 2022-02-28 17:54:25 +01:00
Uwe
4adabe3de8 [App] Document: remove unused includes 2022-02-23 01:56:26 +01:00
Uwe
62496d7277 Revert "App: fix property ordering problem when undo/redo (#3255)"
This reverts commit c3178343db.
2022-02-22 01:21:49 +01:00
Zheng Lei
c3178343db App: fix property ordering problem when undo/redo (#3255)
* Part: fix Placement/Shape onChanged() handling

* App: fix property ordering problem when undo/redo
See https://tracker.freecadweb.org/view.php?id=4265#c14271

* Gui: fix undo/redo signaling
Make sure to signal after all properties has been restored
2022-02-21 12:29:01 +01:00
marioalexis
12883abdbe App: Prevent crash when trying to delete pointer to BaseClass 2022-01-19 08:14:41 +01:00
Zheng, Lei
b32369d185 App: insert UUID property to trace the source of copied object
A property _ObjectUUID will be added to an object before it is being to
copied, if the property does not exists. Anoter propert _SourceUUID
property will be added to any copied object, with value set to its
source objct's _ObjectUUID.
2021-12-21 21:41:02 -07:00
Zheng, Lei
99f199ad7e App: fix pending object remove on recomputing 2021-12-21 21:41:02 -07:00
wmayer
d5726bd7af App: standard path handling
* distinguish between temp and cache location
* document's transident directory is created in the cache location
* add functions to access temp and cache location via Python
2021-11-15 16:26:25 +01:00
Zheng, Lei
14dfae0597 App: add hiddenref() expression built-in function
Any object reference inside this function is treated as hidden to
exclude it from dependency calculation. This function allows some form
of cyclic depdenency.

Merger note: renamed from "HREF" to "HIDDENREF" to avoid confusion with
the standard "hypertext reference" use of HREF.
2021-11-14 20:45:09 -06:00
wmayer
09da245af9 App: harmonize API of App::Application
* make getHomePath() static and return a std::string
* make getExecutableName() static and return a std::string
2021-11-04 10:50:09 +01:00
Zheng, Lei
fc9d3547ad App: fix external document loading
The problem happens when partial loading is enabled. If document A
contains a link to some object in document B, it will load B as partial
document with only that object and its necessary dependencies. But if
document A contains another link to some object in document C which also
has a link to some object in document B, the link in document C may not
be restored, because document B is partially loaded without the linked
object. This patch will check for this case and reload document B for
more objects.

See an example reported in
https://forum.freecadweb.org/viewtopic.php?p=495078#p495078
2021-10-30 11:03:52 +08:00
wmayer
ca05fc678b App: correctly handle UTF-8 encoded path names under Windows 2021-09-29 13:47:29 +02:00
Ajinkya Dahale
b7ea205c70 [App] Fix regression introduced by PR #4996
Files opened by running `freecad xxxx.FCStd` or similar relative paths could not
be saved because of new code introduced to create parent directories. See
https://github.com/FreeCAD/FreeCAD/pull/4996#issuecomment-922370077 and
https://forum.freecadweb.org/viewtopic.php?f=13&t=62319&p=534156#p534156.

This commit resolves the issue by ensuring the parent path is absolute while
saving. We would probably like to make sure the file name is itself stored with
absolute path, but there's a few problems
1. There may be other occurences where files are loaded with relative paths. So
having a check here is a good idea.
2. Files opened by `freecad xxxx.FCStd` somehow don't have the issue where
renaming parent directory throws an exception on save. Instead the file is saved
in the new location.
2021-09-29 13:35:02 +02:00
Yorik van Havre
b8a4d1e07e Merge pull request #4800 from heewa/abort-save-when-unable-to-finish
App: Abort save when unable to finish
2021-09-20 10:47:57 +02:00
wmayer
ef0e303235 App: handle empty, . or .. as parent directory 2021-09-19 18:06:47 +02:00
Ajinkya Dahale
820e88f95b [Core] (Partially?) Fix data loss on dir rename (#4996)
* Fix lost filename in err msg

In some circumstances, FileExceptions are constructed empty, then have a
filename assigned to them, but the error message in these scenarios is
left as the default "unknown" one, which is sometimes shown to users.
This change fixes that case to be consistent with instances that are
constructed with the filename.

The exception can happen when trying to save the file in a location that does
not exist, or when the user does not have permission to write there. If it
comes when saving after closing the document, all previous changes can be lost.

Partially fixes issue #4098.

Co-authored-by: Heewa Barfchin <heewa.b@gmail.com>
2021-09-16 12:06:29 -05:00
Heewa Barfchin
7e11c7bd50 App: Abort save when unable to finish
In these two cases, the project's file will not contain the latest
changes, so returning as if the save is complete is incorrect and can
lead to data loss (such as on app quit).
2021-05-18 11:20:00 -04:00
wmayer
7cf4d4b01e App: [skip ci] AddressSanitizer: heap-use-after-free
In Document::removeObject() do not access object after it has been possibly deleted
2021-02-23 14:30:00 +01:00
Chris Hennes
946e980d1a LGTM: Move seq->next out of loop control
LGTM points out that the construct use in the loop here "does
nothing" -- that is, it is a conditional whose result is never used.
It is apparently being used simply to ensure that the next() function is
called on each loop iteration, but because sequence may be null, it is
shoehorned into a trinary :? operator. To clarify the intent and ensure
that later readers (including LGTM) do not misunderstand it,
this code is broken out into a more standard conditional construct at
the end of each loop iteration.
2021-02-11 12:31:25 +01:00